|
Home > Archive > Voice Over IP in UK > October 2005 > Asterisk - remote ringback
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Asterisk - remote ringback
|
|
|
| This could be a long one, sorry. The question will be
short, but right down at the bottom
Making use of the instructions on Nerd Vittles & with
a lot of help from chandave on Voxilla, I've setup
Asterisk with a special Sipgate DID number.
If either my wife or I call it on from our mobiles,
it rings & should hang up after a couple of rings. (For
some reason, it's not hanging up in this example but is in
the 2nd example, though the call back works fine)
Then, using DISA, Asterisk will wait 8 seconds and call
me back using the trunk specified in line h,100. This happens
to be a premicell to make use of bundled minutes. Once I
answer, it asks me for my password & then gives me
a dialtone. I can then ring out on any of my trunks,
exept for the one doing the call back of course.
Example 1
In extensions_custom_conf:
[custom-sipgate-in]
exten => 1234567,1,NoOp(Incoming call from Sip #1234567); replace 1234567
with your Sipgate DID
exten => 1234567,2,ringing(3)
exten => 1234567,3,Wait(5)
exten => 1234567,4,Congestion
exten => 1234567,5,Hangup
exten => h,1,SetCIDNum(${CALLERIDNUM:0})
exten => h,2,GotoIf($["x${CALLERIDNUM}x" = "xMyMobileCLIDx"]?100)
exten => h,3,GotoIf($["x${CALLERIDNUM}x" = "xWife'sMobileCLIDx"]?100)
exten => h,99,Goto(999)
exten => h,100,System(echo channel: SIP/spa mobile/${CALLERIDNUM} >
/tmp/${CALLERIDNUM});spa mobile is the name of my chosen callback trunk
exten => h,101,System(echo context: custom-disa-callout >>
/tmp/${CALLERIDNUM})
exten => h,102,System(echo extension: ${CALLERIDNUM} >> /tmp/${CALLERIDNUM})
exten => h,103,System(echo priority: 1 >> /tmp/${CALLERIDNUM})
exten => h,104,System(echo callerid: 01234567890 >> /tmp/${CALLERIDNUM}) ;
Your CallerID for your SIP account goes here
exten => h,105,System(echo sleep 8 > /tmp/${CALLERIDNUM}.2)
exten => h,106,System(echo cp /tmp/${CALLERIDNUM}
/var/spool/asterisk/outgoing >> /tmp/${CALLERIDNUM}.2)
exten => h,107,System(chmod 775 /tmp/${CALLERIDNUM}.2)
exten => h,108,System(/tmp/${CALLERIDNUM}.2)
exten => h,109,Goto(999)
exten => h,999,Hangup()
[custom-disa-callout]
exten => s,1,Playback(enter_pin)
exten => s,2,Authenticate(17599)
exten => s,3,Background(pls-wait-connect-call)
exten => s,4,DISA(no-password|from-internal)
***************************************
edit or create & edit disa.conf (in /etc/asterisk)
add the line
SecureNumericPassword|outbound-allroutes ;replace SecureNumericPassword with
numbers!
***************************************
Create a DID (1234567)
Point it to custom app, replace 1234567 with your Sipgate DID
custom-sipgate-in,1234567,1
=======================================
Example 2
In extensions_custom.conf
[custom-landline-in]
exten => 7654321,1,NoOp(Incoming call from Sip #7654321)
exten => 7654321,2,ringing(3)
exten => 7654321,3,Wait(5)
exten => 7654321,4,Congestion
exten => 7654321,5,Hangup
exten => h,1,Goto(100)
exten => h,100,SetVar(num=0044${CALLERIDNUM:1})
exten => h,101,GotoIf($[$num :
^0044[1-2][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]]?:999) ; Priority
999 should be a Hangup()
exten => h,102,SetCIDNum($num)
exten => h,103,System(echo channel: IAX2/sipdiscount/${CALLERIDNUM} >
/tmp/${CALLERIDNUM})
exten => h,104,System(echo context: custom-disa-callout >>
/tmp/${CALLERIDNUM})
exten => h,105,System(echo extension: ${CALLERIDNUM} >> /tmp/${CALLERIDNUM})
exten => h,106,System(echo priority: 1 >> /tmp/${CALLERIDNUM})
exten => h,107,System(echo callerid: 01234567890 >> /tmp/${CALLERIDNUM}) ;
Your CallerID for your SIP account goes here
exten => h,108,System(echo sleep 20 > /tmp/${CALLERIDNUM}.2)
exten => h,109,System(echo cp /tmp/${CALLERIDNUM}
/var/spool/asterisk/outgoing >> /tmp/${CALLERIDNUM}.2)
exten => h,110,System(chmod 775 /tmp/${CALLERIDNUM}.2)
exten => h,111,System(/tmp/${CALLERIDNUM}.2)
exten => h,112,Goto(999)
exten => h,999,Hangup()
**************************************
Create a DID (7654321)
Point it to custom app, replace 7654321 with your Sipgate DID
custom-landline-in,7654321,1
**************************************
In the above example, I'm attempting to allow a call back
ONLY to numbers that start 01 or 02 and are 11 digits
long - so that it can be used from any landline or payphone.
Line h,100 strips the leading zero & prepends 0044 and
sets this number as the variable num
Line h,100 checks that the number (now) is in the format
00441XXXXXXXXX or 00442XXXXXXXXX, I think. If the number
isn't in this format, it should go to priority 999,
which is a hang up.
Unfortunately, the call back nevers happens. (it works great
in example 1)
Any experts see any errors around lines h,100 to 103 in example 2?
| |
|
|
"Jono" <no@nospamblueyonder.co.uk> wrote in message
news:2wx8f.139826$G8.72016@text.news.blueyonder.co.uk...
> This could be a long one, sorry. The question will be
> short, but right down at the bottom
>
> Making use of the instructions on Nerd Vittles & with
> a lot of help from chandave on Voxilla, I've setup
> Asterisk with a special Sipgate DID number.
>
> If either my wife or I call it on from our mobiles,
> it rings & should hang up after a couple of rings. (For
> some reason, it's not hanging up in this example but is in
> the 2nd example, though the call back works fine)
>
> Then, using DISA, Asterisk will wait 8 seconds and call
> me back using the trunk specified in line h,100. This happens
> to be a premicell to make use of bundled minutes. Once I
> answer, it asks me for my password & then gives me
> a dialtone. I can then ring out on any of my trunks,
> exept for the one doing the call back of course.
>
> Example 1
>
> In extensions_custom_conf:
>
> [custom-sipgate-in]
> exten => 1234567,1,NoOp(Incoming call from Sip #1234567); replace 1234567
> with your Sipgate DID
> exten => 1234567,2,ringing(3)
> exten => 1234567,3,Wait(5)
> exten => 1234567,4,Congestion
> exten => 1234567,5,Hangup
> exten => h,1,SetCIDNum(${CALLERIDNUM:0})
> exten => h,2,GotoIf($["x${CALLERIDNUM}x" = "xMyMobileCLIDx"]?100)
> exten => h,3,GotoIf($["x${CALLERIDNUM}x" = "xWife'sMobileCLIDx"]?100)
> exten => h,99,Goto(999)
> exten => h,100,System(echo channel: SIP/spa mobile/${CALLERIDNUM} >
> /tmp/${CALLERIDNUM});spa mobile is the name of my chosen callback trunk
> exten => h,101,System(echo context: custom-disa-callout >>
> /tmp/${CALLERIDNUM})
> exten => h,102,System(echo extension: ${CALLERIDNUM} >>
/tmp/${CALLERIDNUM})
> exten => h,103,System(echo priority: 1 >> /tmp/${CALLERIDNUM})
> exten => h,104,System(echo callerid: 01234567890 >> /tmp/${CALLERIDNUM}) ;
> Your CallerID for your SIP account goes here
> exten => h,105,System(echo sleep 8 > /tmp/${CALLERIDNUM}.2)
> exten => h,106,System(echo cp /tmp/${CALLERIDNUM}
> /var/spool/asterisk/outgoing >> /tmp/${CALLERIDNUM}.2)
> exten => h,107,System(chmod 775 /tmp/${CALLERIDNUM}.2)
> exten => h,108,System(/tmp/${CALLERIDNUM}.2)
> exten => h,109,Goto(999)
> exten => h,999,Hangup()
>
> [custom-disa-callout]
> exten => s,1,Playback(enter_pin)
> exten => s,2,Authenticate(17599)
> exten => s,3,Background(pls-wait-connect-call)
> exten => s,4,DISA(no-password|from-internal)
>
> ***************************************
>
> edit or create & edit disa.conf (in /etc/asterisk)
>
> add the line
>
> SecureNumericPassword|outbound-allroutes ;replace SecureNumericPassword
with
> numbers!
>
> ***************************************
>
> Create a DID (1234567)
>
> Point it to custom app, replace 1234567 with your Sipgate DID
> custom-sipgate-in,1234567,1
>
> =======================================
>
> Example 2
>
> In extensions_custom.conf
>
> [custom-landline-in]
> exten => 7654321,1,NoOp(Incoming call from Sip #7654321)
> exten => 7654321,2,ringing(3)
> exten => 7654321,3,Wait(5)
> exten => 7654321,4,Congestion
> exten => 7654321,5,Hangup
> exten => h,1,Goto(100)
> exten => h,100,SetVar(num=0044${CALLERIDNUM:1})
> exten => h,101,GotoIf($[$num :
> ^0044[1-2][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]]?:999) ; Priority
> 999 should be a Hangup()
> exten => h,102,SetCIDNum($num)
> exten => h,103,System(echo channel: IAX2/sipdiscount/${CALLERIDNUM} >
> /tmp/${CALLERIDNUM})
> exten => h,104,System(echo context: custom-disa-callout >>
> /tmp/${CALLERIDNUM})
> exten => h,105,System(echo extension: ${CALLERIDNUM} >>
/tmp/${CALLERIDNUM})
> exten => h,106,System(echo priority: 1 >> /tmp/${CALLERIDNUM})
> exten => h,107,System(echo callerid: 01234567890 >> /tmp/${CALLERIDNUM}) ;
> Your CallerID for your SIP account goes here
> exten => h,108,System(echo sleep 20 > /tmp/${CALLERIDNUM}.2)
> exten => h,109,System(echo cp /tmp/${CALLERIDNUM}
> /var/spool/asterisk/outgoing >> /tmp/${CALLERIDNUM}.2)
> exten => h,110,System(chmod 775 /tmp/${CALLERIDNUM}.2)
> exten => h,111,System(/tmp/${CALLERIDNUM}.2)
> exten => h,112,Goto(999)
> exten => h,999,Hangup()
>
> **************************************
>
> Create a DID (7654321)
>
> Point it to custom app, replace 7654321 with your Sipgate DID
> custom-landline-in,7654321,1
>
> **************************************
>
> In the above example, I'm attempting to allow a call back
> ONLY to numbers that start 01 or 02 and are 11 digits
> long - so that it can be used from any landline or payphone.
>
> Line h,100 strips the leading zero & prepends 0044 and
> sets this number as the variable num
>
> Line h,100 checks that the number (now) is in the format
> 00441XXXXXXXXX or 00442XXXXXXXXX, I think. If the number
> isn't in this format, it should go to priority 999,
> which is a hang up.
>
> Unfortunately, the call back nevers happens. (it works great
> in example 1)
>
> Any experts see any errors around lines h,100 to 103 in example 2?
>
>
you could try
exten => h,100,SetVar(test=${CALLERIDNUM:2:1})
exten => h,101,GotoIf($[${test} = [1-2]]?103) ; Priority 103 would be the
continuation of the call
exten => h,102,Goto (custom-landline-in,h,999);
This has assumed the cli is presented in UK number format not 0044 also I
havent tested the length but thats not hard.
I havn't tested that it would work but it looks ok.
Ian
www.cyber-cottage.co.uk
| |
|
|
||| Any experts see any errors around lines h,100 to 103 in example 2?
|||
|||
|| you could try
||
|| exten => h,100,SetVar(test=${CALLERIDNUM:2:1})
|| exten => h,101,GotoIf($[${test} = [1-2]]?103) ; Priority 103 would be
|| the continuation of the call
|| exten => h,102,Goto (custom-landline-in,h,999);
||
|| This has assumed the cli is presented in UK number format not 0044
|| also I havent tested the length but thats not hard.
||
|| I havn't tested that it would work but it looks ok.
||
|| Ian
|| www.cyber-cottage.co.uk
Hello Ian,
Thanks for taking the time to reply.
I will check out your suggestion!
Could you, by any chance explain the arguments used in:
exten => h,101,GotoIf($[${test} = [1-2]]?103)
Cheers.
| |
|
|
"Jono" <no@nospamblueyonder.co.uk> wrote in message
news:TzJ8f.139995$G8.114030@text.news.blueyonder.co.uk...
>
>
> ||| Any experts see any errors around lines h,100 to 103 in example 2?
> |||
> |||
> || you could try
> ||
> || exten => h,100,SetVar(test=${CALLERIDNUM:2:1})
> || exten => h,101,GotoIf($[${test} = [1-2]]?103) ; Priority 103 would be
> || the continuation of the call
> || exten => h,102,Goto (custom-landline-in,h,999);
> ||
> || This has assumed the cli is presented in UK number format not 0044
> || also I havent tested the length but thats not hard.
> ||
> || I havn't tested that it would work but it looks ok.
> ||
> || Ian
> || www.cyber-cottage.co.uk
>
> Hello Ian,
>
> Thanks for taking the time to reply.
>
> I will check out your suggestion!
>
> Could you, by any chance explain the arguments used in:
> exten => h,101,GotoIf($[${test} = [1-2]]?103)
>
> Cheers.
>
Havng reread it it looks wrong.
The following should work though
(still not tested it but it looks ok)
exten => h,101,GotoIf( $["${CALLERIDNUM:1:1}" = "1"]?105) ; Priority 105
would be the continuation of the call
exten => h,102,GotoIf( $["${CALLERIDNUM:1:1}" = "2"]?105) ; Priority 105
would be the continuation of the call
exten => h,103,GotoIf ($[${LEN(${CALLERIDNUM})} = 11]?105) ; Priority 105
would be the continuation of the call
exten => h,104,Goto (custom-landline-in,h,999);
as to what its doing 101 checks to see if the second digit is 102 checks to
see if its 2 then 103 checks that its 11 digits long.
Ian
www.cyber-cottage.co.uk
| |
|
|
Ian" <spam"AT wrote:
|| as to what its doing 101 checks to see if the second digit is 102
|| checks to see if its 2 then 103 checks that its 11 digits long.
||
|| Ian
|| www.cyber-cottage.co.uk
That's very clever. I've been amazed at how many different ways there are of
doing things.
I've (only just) got it all working with the following:
[custom-landline-in]
exten => 7654321,1,NoOp(Incoming call from Sip #7654321)
exten => 7654321,2,ringing(3)
exten => 7654321,3,Wait(5)
exten => 7654321,4,Congestion
exten => 7654321,5,Hangup
exten => h,1,Goto(100)
exten => h,100,GotoIf(${CALLERIDNUM} :
0[1-2][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]])?:999)
exten => h,101,System(echo channel: IAX2/sipdiscount/0044${CALLERIDNUM:1} >
/tmp/${CALLERIDNUM})
exten => h,102,System(echo context: custom-disa-callout >>
/tmp/${CALLERIDNUM})
exten => h,103,System(echo extension: ${CALLERIDNUM} >> /tmp/${CALLERIDNUM})
exten => h,104,System(echo priority: 1 >> /tmp/${CALLERIDNUM})
exten => h,105,System(echo callerid: 01234567890 >> /tmp/${CALLERIDNUM})
exten => h,106,System(echo sleep 20 > /tmp/${CALLERIDNUM}.2)
exten => h,107,System(echo cp /tmp/${CALLERIDNUM}
/var/spool/asterisk/outgoing >> /tmp/${CALLERIDNUM}.2)
exten => h,108,System(chmod 775 /tmp/${CALLERIDNUM}.2)
exten => h,109,System(/tmp/${CALLERIDNUM}.2)
exten => h,110,Goto(999)
exten => h,999,Hangup()
| |
|
|
"Jono" <no@nospamblueyonder.co.uk> wrote in message
news:nsO8f.140146$G8.20307@text.news.blueyonder.co.uk...
> exten => h,100,GotoIf(${CALLERIDNUM} :
0[1-2][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]])?:999)
I can see that you have a false destination but no true destination, Does i
fail if you dial in with a mobile or have international CLI.? I have not
seen Gotoif documented like this. are you sure its not just steppng through
as i can see a clossing bracket but no opening one.
Ian
| |
|
|
"Ian" <spam"AT"bathfordhill.co.uk> wrote in message
news:11m7g1fd40fv873@corp.supernews.com...
>
> "Jono" <no@nospamblueyonder.co.uk> wrote in message
> news:nsO8f.140146$G8.20307@text.news.blueyonder.co.uk...
>
> 0[1-2][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]])?:999)
>
> I can see that you have a false destination but no true destination, Does
> i
> fail if you dial in with a mobile or have international CLI.? I have not
> seen Gotoif documented like this. are you sure its not just steppng
> through
> as i can see a clossing bracket but no opening one.
>
>
> Ian
>
>
Well spotted..........it doesn't fail on my mobile....funny, I thought it
did - it must've failed before for some other reason. Bugger. What's
missing?
| |
|
|
"Jono" <home@home.co.uk> wrote in message
news:PqP8f.140196$G8.139130@text.news.blueyonder.co.uk...
>
> "Ian" <spam"AT"bathfordhill.co.uk> wrote in message
> news:11m7g1fd40fv873@corp.supernews.com...
Does[vbcol=seagreen]
>
> Well spotted..........it doesn't fail on my mobile....funny, I thought it
> did - it must've failed before for some other reason. Bugger. What's
> missing?
>
>
Well I dont know whats missing as Iv never seen this way of using the Gotoif
command. Where is this way documented ?
Personaly I use it like i posted earlier or comparing against entries in
the database.
The wiki has some good info on Gotoif its worth a read.
For what you are trying to do I would use authenticate a that way it proves
the caller has the rights to get the call back.
Details of using authenticate and the internal database are at
http://www.cyber-cottage.co.uk/wiki...p/Asterisk_auth and more in the
wiki
Ian
| |
|
|
Ian" <spam"AT wrote:
|| "Jono" <home@home.co.uk> wrote in message
|| news:PqP8f.140196$G8.139130@text.news.blueyonder.co.uk...
|||
||| "Ian" <spam"AT"bathfordhill.co.uk> wrote in message
||| news:11m7g1fd40fv873@corp.supernews.com...
||||
|||| "Jono" <no@nospamblueyonder.co.uk> wrote in message
|||| news:nsO8f.140146$G8.20307@text.news.blueyonder.co.uk...
||||
||||| exten => h,100,GotoIf(${CALLERIDNUM} :
|||| 0[1-2][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]])?:999)
||||
|||| I can see that you have a false destination but no true destination,
|||| Does i
|||| fail if you dial in with a mobile or have international CLI.? I have
|||| not seen Gotoif documented like this. are you sure its not just
|||| steppng through
|||| as i can see a clossing bracket but no opening one.
||||
||||
|||| Ian
||||
||||
|||
||| Well spotted..........it doesn't fail on my mobile....funny, I
||| thought it did - it must've failed before for some other reason.
||| Bugger. What's missing?
|||
|||
|| Well I dont know whats missing as Iv never seen this way of using the
|| Gotoif command. Where is this way documented ?
|| Personaly I use it like i posted earlier or comparing against entries
|| in the database.
|| The wiki has some good info on Gotoif its worth a read.
|| For what you are trying to do I would use authenticate a that way it
|| proves the caller has the rights to get the call back.
|| Details of using authenticate and the internal database are at
|| http://www.cyber-cottage.co.uk/wiki...p/Asterisk_auth and more
|| in the wiki
||
|| Ian
Thank you Ian.
I've been in discussion with a chap on the voxilla website. He's helped me a
great deal - I have a different call back number, as a direct result, that
is doing exactly what I need for that application. (it authenticates by
CLID)
http://voxilla.com/PNphpBB2-viewtop...sc-start-0.html
However, for this particular application, I want to be able to call from any
(& only a) landline, then call back to the same landline, then authenticate
by password & get a VOIP dialtone. (Actually I will then want to restrict
calls to landlines @ the dialtone as well) I think I'm being a little dense
& am not getting too far with the latest attempt!
| |
|
|
Ian" <spam"AT wrote:
|| "Jono" <home@home.co.uk> wrote in message
|| news:PqP8f.140196$G8.139130@text.news.blueyonder.co.uk...
|||
||| "Ian" <spam"AT"bathfordhill.co.uk> wrote in message
||| news:11m7g1fd40fv873@corp.supernews.com...
||||
|||| "Jono" <no@nospamblueyonder.co.uk> wrote in message
|||| news:nsO8f.140146$G8.20307@text.news.blueyonder.co.uk...
||||
||||| exten => h,100,GotoIf(${CALLERIDNUM} :
|||| 0[1-2][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]])?:999)
||||
|||| I can see that you have a false destination but no true destination,
|||| Does i
|||| fail if you dial in with a mobile or have international CLI.? I have
|||| not seen Gotoif documented like this. are you sure its not just
|||| steppng through
|||| as i can see a clossing bracket but no opening one.
||||
||||
|||| Ian
||||
||||
|||
||| Well spotted..........it doesn't fail on my mobile....funny, I
||| thought it did - it must've failed before for some other reason.
||| Bugger. What's missing?
|||
|||
|| Well I dont know whats missing as Iv never seen this way of using the
|| Gotoif command. Where is this way documented ?
|| Personaly I use it like i posted earlier or comparing against entries
|| in the database.
|| The wiki has some good info on Gotoif its worth a read.
|| For what you are trying to do I would use authenticate a that way it
|| proves the caller has the rights to get the call back.
|| Details of using authenticate and the internal database are at
|| http://www.cyber-cottage.co.uk/wiki...p/Asterisk_auth and more
|| in the wiki
||
|| Ian
Hi Ian,
The kindly chap on Voxilla, "chandave" just posted a reply...........and now
it's working as a hoped it would.
exten => h,100,GotoIf($[${CALLERIDNUM} :
0[1-2][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]])?:999) ;999 is a hang
up.
|
|
|
|
|