How-To: Distinguish PSTN, Skype, iNum, and SIP in your Tropo applications
Here at the secret layers of Tropo Support we often see similar questions raised by our developer base. We pay attention to these trends, since they often indicate that something may be lacking in our documentation. If we do find something is lacking we of course want to address by expanding on concepts or adding additional examples to help shore up our doc sets and help out our developers.
Recently I have started to notice a trend of developers asking how to determine the source of callers dialing into their applications (Skype, PSTN, SIP, or iNum). We’ll since we are often asked this question I figured I would provide a nice example for the ‘class’ =), I do hope this help!
Regards,
John Dyer
Customer Engineer
Voxeo Support# ----------- # route based on DNIS # John Dyer # Voxeo Support # ----------- log "@"*10 $currentCall.inspect # List some headers log "@"*10 $currentCall.getHeader("x-voxeo-to") # log to header module SipRegex def evaluate_sip_header(header) if header =~ /^<sip:990.*$/ # SKYPE "SKYPE" elsif header =~ /^.*<sip:1999.*$/ # SIP "SIP" elsif header =~ /^<sip:883.*$/ # iNUM "INUM" elsif header =~ /^.*<sip:|[1-9][0-9][0-9].*$/ # PSTN "PSTN" else "OTHER" end end end include SipRegex toHeader = evaluate_sip_header($currentCall.getHeader("x-voxeo-to")) if toHeader == 'PSTN' answer log "@"*10 toHeader hangup elsif toHeader == 'SKYPE' answer log "@"*10 toHeader hangup elsif toHeader == 'PSTN' answer log "@"*10 toHeader hangup elsif toHeader == 'INUM' answer log "@"*10 toHeader hangup elsif toHeader == 'OTHER' answer log "@"*10 toHeader hangup else log "@"*10 "SOMETHING BAD HAPPENED" end
Originally from Voxeo Blogs

Leave a Reply