简体   繁体   中英

How to pass the original Caller ID on Twilio? (Sip Domain Voice URL Configuration)

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!

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 ."

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM