第一次使用astersik,第一次使用php。我使用Asterisk 12,我想在我的php代码中添加一个带有值的SIP标头,然后将呼叫转移到另一个星号服务器,并获取我的SIP标头。
---------------------------php code in server a-------------------------
#!/usr/bin/php -q
<?php
require('phpagi.php');
error_reporting(E_ALL);
$agi = new AGI();
$agi->answer();
//I want to set a Sip Header here
//for example set OrderId = 5566
$agi-> exec("DIAL SIP/omid/3444");
?>
并且当呼叫转移到服务器b时,我想获取我的SIP标头
---------------------------php code in server b-------------------------
#!/usr/bin/php -q
<?php
require('phpagi.php');
error_reporting(E_ALL);
$agi = new AGI();
$agi->answer();
//Get OrderId from SIP Header and show it
//$agi->Verbose('OrderId:'.$orderIdFromHeader);
$agi->hangup();
?>
您无法从php添加标头。
您可以使用拨号计划来完成
pro-sip*CLI> core show applications like header
-= Matching Asterisk Applications =-
SIPAddHeader: Add a SIP header to the outbound call.
SIPRemoveHeader: Remove SIP headers previously added with SIPAddHeader
-= 2 Applications Matching =-
对于使用拨号计划,您应该通过通道类型本地而非SIP进行拨号。>>
您可以使用功能阅读标题:
pro-sip*CLI> core show functions like HEADER
Matching Custom Functions:
--------------------------------------------------------------------------------
SIP_HEADER SIP_HEADER(name[,number]) Gets the specified SIP header from an incoming INVITE message.
1 matching custom functions installed.