planetWayne Site Admin
Joined: 30 Jan 2003 Posts: 280
|
Posted: Sun Sep 19, 2004 6:38 pm Post subject: URL Dialing |
|
|
This one allows you to 'dial' a SIP URL from your phone (as long as you can input letters!) - I have a set of Cisco 7960's which you can type letters into your dialing string.
You may think this is simple to do on one front - you just stick the URL in and away you go ('person@othernetwork.com') - but all is not as it first appears.
For some reason Asterisk does not like accepting a '@' simbol as part of the dialed number. So we have to work around the fact that we cant send a '@' from the phone. The way I've done this is to use another substitute character that you 'dial' from the phone. This then gets replaced by the context to be correct to dial with.
If you have read any of my other posts you will see I use global variables to hold extentions (for ease of changing to suit your dial plan) also, with this, theres a variable to hold the character you are looking to replace the '@' with.
So - In your globals - a few variables
Code: | [globals]
URLATMARK==
URLACCESSCODE=82 |
My substitute character in this example is '='. I did opt for the '#' as a suitable replacement but the Cisco's use this to 'send' your dial string so you would only be able to dial the first part of the URL!
URLACCESSCODE=82 may seem a bit strange. You know the old '9 for an outside line' well I've gone for '8 for an internet call'. '81' for a FreeWorld Dial number, and '82' to start a URL number. Neat eh.
The next context needs to be 'included' within your phones context so it can be called when you want to make an internet call.
Code: | [urldial]
exten => _${URLACCESSCODE}.,1,NoOp,${EXTEN}
exten => _${URLACCESSCODE}.,2,Setvar(url=${EXTEN:${LEN(${URLACCESSCODE})}})
exten => _${URLACCESSCODE}.,3,NoOp,${url}
exten => _${URLACCESSCODE}.,4,cut(name=url,${URLATMARK},1)
exten => _${URLACCESSCODE}.,5,NoOp,${name}
exten => _${URLACCESSCODE}.,6,cut(address=url,${URLATMARK},2)
exten => _${URLACCESSCODE}.,7,NoOp,${address}
exten => _${URLACCESSCODE}.,8,NoOp,${name}@${address}
exten => _${URLACCESSCODE}.,9,Setvar(FullAddr=${name}@${address})
exten => _${URLACCESSCODE}.,10,NoOp,${FullAddr}
exten => _${URLACCESSCODE}.,11,dial(SIP/${FullAddr},120)
exten => _${URLACCESSCODE}.,12,hangup
|
Theres a few NoOps in there you can remote - but it was there to help debugging. |
|