OTRS SOAP API
Answers
-
<?php function create_ticket($mail_sub, $mail_to, $mail_BCC, $mail_from, $mail_body, $otrs_reff = array()) { $url = "https://my.host.com/otrs/rpc.pl"; $username = "OTRS_SOAP_user"; $password = "password"; $TicketNr = (isset($otrs_reff['TicketNr']) && !empty($otrs_reff['TicketNr'])) ? $otrs_reff['TicketNr'] : null; $TicketID = (isset($otrs_reff['TicketID']) && !empty($otrs_reff['TicketID'])) ? $otrs_reff['TicketID'] : null; $ArticleID = null; global $num; global $name; # Set up a new SOAP connection: $client = new SoapClient(null, array( 'location' => $url, 'uri' => "Core", 'trace' => 1, 'login' => $username, 'password' => $password, 'style' => SOAP_RPC, 'use' => SOAP_ENCODED) ); if($TicketNr && $TicketID){ $TicketNr = $client->__soapCall("Dispatch", array($username, $password, "TicketObject", "TicketNumberLookup", "TicketID", $TicketID, ) ); if(!$TicketNr){ $TicketID = null; } } if(!$TicketNr && !$TicketID){ $TicketCreateNumber = $client->__soapCall("Dispatch", array( $username, $password, "TicketObject", "TicketCreateNumber" )); if(! is_string($TicketCreateNumber) ) $TicketNr = number_format($TicketCreateNumber,0, '.', ''); if($TicketNr){ $TicketID = $client->__soapCall("Dispatch", array($username, $password, "TicketObject", "TicketCreate", "TN", $TicketNr, "Title", $mail_sub, "Queue", "Eurus|NOC", "Lock" , "unlock", "PriorityID", 3, "State" , "open", "CustomerID", $mail_from, "CustomerUser", $mail_from, "OwnerID", 1, "UserID", 1 ) ); } } if($TicketNr && $TicketID){ $ArticleID = $client->__soapCall("Dispatch", array($username, $password, "TicketObject", "ArticleSend", "TicketID", $TicketID, "ArticleType", "email-external", "SenderType", "agent", "From", $mail_from, "To", $mail_to, "Bcc", $mail_BCC, "Subject", '[Ticket#'.$TicketNr.'] '.$mail_sub, "ContentType", "text/html; charset=utf-8", "Charset", "utf-8", "HistoryType", "EmailCustomer", "HistoryComment", "generated by SPAM CALLS ALERT", "Body", $mail_body, "UserID", 1, "NoAgentNotify", 0, "MimeType", "text/html", "Loop", 0 ) ); } return array( "TicketNr" => $TicketNr, "TicketID" => $TicketID, "ArticleID" => $ArticleID ); } ?>
0
Howdy, Stranger!
Categories
- 94 All Categories
- 20 VoIP
- 7 SIP
- 16 asterisk
- 44 Programming
- 1 Nodejs
- 4 javascript
- 19 PHP
- 8 Codeigniter
- 14 database
- 1 UI/UX
- 2 Flutter
- 28 OS
- 26 Linux
- 1 Virtualization
- 1 Android
- 1 Windows
- 2 legal