ftocc

(HOWTO) strip + from DID and CID for bandwidth.com, also set DID as if doing RDNIS

mjoyner
Posts: 127
Member Since:
2007-06-11

---> a)

goto config edit -> extensions_custom.conf
add at the end then "update" then "reload configs"

[custom-frombandwidth]
exten => _+1.,1,NOOP(=CUSTOM-FROM-BANDWIDTH===========)
exten => _+1.,n,Set(pseudodid=${SIP_HEADER(To)})
exten => _+1.,n,Set(pseudodid=${CUT(pseudodid,@,1)})
exten => _+1.,n,Set(pseudodid=${CUT(pseudodid,:,2)})
exten => _+1.,n,Set(DID=${pseudodid:-10})
exten => _+1.,n,NoOp({pseudodid} = ${pseudodid})
exten => _+1.,n,NoOp({DNID} = ${CALLERID(DNID)})
exten => _+1.,n,NoOp({RDNIS} = ${CALLERID(RDNIS)})
exten => _+1.,n,NoOp({EXTEN} = ${EXTEN})
exten => _+1.,n,NoOp({CALLERID} = ${CALLERID(num)})
exten => _+1.,n,NoOp({CHANNEL} = ${CHANNEL})
extrn => _+1.,n,NoOp({CONTEXT} = ${CONTEXT})
exten => _+1.,n,NOOP(=================================)
exten => _+1.,n,Set(CALLERID(num)=${CALLERID(num):-10})
exten => _+1.,n,Set(CALLERID(ANI)=${CALLERID(num)})
exten => _+1.,n,Goto(from-trunk,${DID},1)

exten => _+.,1,NOOP(=CUSTOM-FROM-BANDWIDTH=INTERNATIONAL==)
exten => _+1.,n,Set(pseudodid=${SIP_HEADER(To)})
exten => _+1.,n,Set(pseudodid=${CUT(pseudodid,@,1)})
exten => _+1.,n,Set(pseudodid=${CUT(pseudodid,:,2)})
exten => _+1.,n,Set(DID=${pseudodid:-10})
exten => _+.,n,Set(CALLERID(num)=${CALLERID(num):1})
exten => _+.,n,Set(CALLERID(ANI)=${CALLERID(num)})
exten => _+.,n,NoOp({DNID} = ${CALLERID(DNID)})
exten => _+.,n,NoOp({RDNIS} = ${CALLERID(RDNIS)})
exten => _+.,n,Goto(from-trunk,${DID},1)

---> b)

BOTH of your bandwidth trunks, BW1, and BW2 (primary and secondary), should read like the following, adjusting of course for any particulars for your service setup.

Trunk Name: BW1

Peer Details:
   type=peer
   qualify=yes
   port=5060
   nat=yes
   host=216.82.224.202
   dtmfmode=rfc2833
   disallow=all
   canreinvite=no
   allow=ulaw&alaw

USER Context: FBW1
   type=peer
   qualify=yes
   port=5060
   nat=yes
   insecure=very
   host=216.82.224.202
   fromdomain=216.82.224.202
   dtmfmode=rfc2833
   disallow=all
   context=custom-frombandwidth
   canreinvite=no
   allow=ulaw

The key factor is the "context=custom-frombandwidth" component in the USER Context, this causes inbound calls from bandwidth to go through the frombandwidth custom context allowing use to "massage" the data a little before processing it as if it were a directly dialed setup by going back into the from-trunk context.

Make sure you have inbound routes setup to handle 10-digit sized inbound DID's!!!



mjoyner
Posts: 127
Member Since:
2007-06-11
NOTE! If you use call forwarding on another system into this scr

NOTE! If you use call forwarding on another system into this script, bandwidth actually forwards the RDNIS number as the sip to address, so that the inbound DID becomes the number that was forwarded from.

So, for example (for what I use this for here at Edward Waters College)

Centrex analog line, features added: call forward no answer -> bandwidth did#
call forward busy -> bandwidth did#

When someone calls centrex line, it is not answered or is busy, call is transferred to bandwidth did#, the sip header (to) contains the centrex line did# and *not* the bandwidth did#, this allows me to route to proper voicemail box for said line



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.