douyaju4259 2019-04-11 13:01
浏览 124

如何在Twilio上传递原来的来电显示? (Sip域语音URL配置)

In short, I have a Twilio Elastic SIP Trunk and configured my PBX (Asterisk) to make outbound calls through the SIP Domain on Twilio; when logging into Twilio I have the option of configuring the SIP Domain's voice configuration URL so when a call is dialed out, the script passes the call to its destination.

For whatever reason, it used to pass the original caller ID of the person when I forward a call out but now it keeps overwriting the Caller ID with my office's number; essentially masking the original caller's caller ID when a call is transferred out; this is pretty annoying and I'm trying to figure out the best way to resolve it.

My goal is to fix outbound dialing so when a call is transferred externally, the caller ID of the individual should display instead of my office's number;

The Twiml config I have for my SIP Domain's voice URI looks like this:

<?php
echo header('content-type: text/xml');
echo '<?xml version="1.0" encoding="UTF-8"?>';
$to=$_REQUEST['To'];
$callerId=$_REQUEST["callerId"];
/** Extracting user name **/
$pos1 = strpos($to,":");
$pos2 = strpos($to,"@");
$tosip=substr($to,$pos1+1,$pos2-$pos1-1);
if(strlen($tosip) == 3)
{
/**Extracting sip endpoint**/
    $pos2 = strpos($to,":",strpos($to,":")+1);
    $tosip=substr($to,$pos1+1,$pos2-$pos1-1);

    ?>
    <Response>
        <Dial>
            <Sip>
                <?php echo $tosip; ?>
            </Sip>
        </Dial>
    </Response>
    <?php } else { if(substr($tosip,0,2)=="00") $tosip=substr($tosip,2,strlen($tosip)-1); if(substr($tosip,0,3)=="011") $tosip=substr($tosip,3,strlen($tosip)-1); ?>
    <Response>
        <Dial callerId="<?php echo $callerId; ?>" >
            <?php echo $tosip; ?>
        </Dial>
    </Response>
    <?php } ?>

To successfully pass the call I have to make the $GET param for CallerId my office's number; but this overwrites the original caller ID; it used to be I could simply call the verb and the original caller ID would appear; but now it doesn't seem the case.

Any advice or point in the right direction appreciated!

  • 写回答

1条回答 默认 最新

  • douzhi7082 2019-04-13 13:01
    关注

    This is going to be an issue. Programmable Voice SIP Domains, require the CallerID to either be a verified Caller ID or a Twilio phone number in your account when calling out to the Public Switched Telephone Network (PSTN).

    The ability to forward inbound CallerID to the outbound destination would only work from a call forwarding context (the call comes into Twilio from the PSTN and then you forward it on with a Dial verb to the PSTN as an example).

    "When you use in your response to Twilio's inbound call request, the dialed party sees the inbound caller's number as the caller ID."

    评论

报告相同问题?

悬赏问题

  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题
  • ¥15 Python时间序列如何拟合疏系数模型