Situation : I made a trunk between a landline and my server so that whenever someone calls my landline he goes through the dialplan I made in extensions.conf.
Question : Now, taking into account that I have credits on that landline, is it possible to redirect the call to another landline ?
When using command Dial() I have to specify a technology (IAX, SIP,ZAP etc) but in order to redirect the call to a landline (landline2 in the following example) I don't know which one should be used.
Here's what I have so far :
[test]
exten => *mylandlinenumber*,1,Answer()
exten => *mylandlinenumber*,2,MixMonitor(${STRFTIME(${EPOCH},,%d%m%Y-%H:%M:%S)}.wav)
exten => *mylandlinenumber*,3,Goto(langue_select,s,1)
[langue_select]
exten => s,1,Background(/var/lib/asterisk/sounds/intro2168000) ; ce fichier a une fréquence de 8000. Export ->Wav -> Microsoft 16bit
exten => s,2,WaitExten(5)
exten => 1,1,Goto(francais,s,1)
exten => 2,1,Goto(english,s,1)
[francais]
exten => s,1,Background(/var/lib/asterisk/sounds/FrancaisSlowNew168000)
exten => 1,1,Goto(call_forward,s,1)
;EDIT : What follows what added
[call_forward]
exten => s,1,Set(temp=${DB(CFIM/41XXXXXXXXX)}) ; with 41XXXXXXXXX as landline 1
exten => s,n,GotoIf(${temp}?cfim:nocfim)
exten => s,n(cfim),Dial(Local/${temp}#default/n) ; Unconditional forward
exten => s,n(nocfim),NoOp
exten => s,n,Dial(41YYYYYYYYY,15) ; with 41YYYYYYYYY as landline 2
exten => s,n,Set(temp=${DB(CFBS/41XXXXXXXXX)})
exten => s,n,GotoIf(${temp}?cfbs:nocfbs)
exten => s,n(cfbs),Dial(Local/${temp}#default/n) ; Forward on busy or unavailable
exten => s,n(nocfbs),Busy
When calling here I get this error in the debug :
WARNING[466][C-0001c8c7]: app_dial.c:2467 dial_exec_full: Dial argument takes format (technology/resource)
== Spawn extension (call_forward, s, 5) exited non-zero on 'SIP/95.128.80.93-00000015'
If you have dahdi card, type is DADHI.
If you have sip FXO/FXS adapter, type is SIP.
It greatly depend of what you use to connect landline.
Related
i am using asterisk to forward calls from a softswitch to gateways, i want to allow only calls with 10 digit caller id for eg 7181234567 and NOT caller id more than 10 digits
in my extensions.conf file it has as default:
[globals]
[default]
exten => _X.,1,Set(CALLERID(NUM)=${FILTER(0123456789,${CALLERID(NUM)})})
exten => _X.,n,goto(a2billing-did,${EXTEN},1)
HOW can i allow only 10 digit caller ids through the system
Asterisk pattern have two part, DST and SRC
This info is public avalible, not recommend you go with asterisk if you not read about patterns.
https://wiki.asterisk.org/wiki/display/AST/Pattern+Matching
For your case (src exactly 10 digits) will be something like this
exten => _X./_XXXXXXXXXX,Something
or
exten => _X./_NXXNXXXXXX,Something
exten => _NXXNXXXXXX,1,Set(CALLERID(num)=${CALLERID(num)})
exten => _NXXNXXXXXX,n,GotoIf($[${LEN(${CALLERID(num)})} = 10]?allow:reject)
exten => _NXXNXXXXXX,n(allow),Set(CALLERID(NUM)=${FILTER(0123456789,${CALLERID(NUM)})})
exten => _NXXNXXXXXX,n,goto(a2billing-did,${EXTEN},1)
exten => _NXXNXXXXXX,n(reject),Hangup()
I need some help here.
I try to configure dolibarr's plugin "Calling" on my asterisk.
I need to configure my extensions.conf so that all incoming calls on my asterisk return information to my dolibarr in order to have call notifications...
When I call from outside my softphone rings correctly, but as soon as I get off I get the following error message:
WARNING[3314][C-0000000d]: app.c:326 ast_app_exec_macro: Cannot run 'Macro(dolinotif)'. The application is not available.
Here my Extensions.conf :
[Entrant] exten => s,1,Goto(dolibarr_notification,s,1) ;Redirection
exten => _X.,1,NoOp()
exten => _X.,n,Set(__DOLI_CALLER=${CUT(CUT(SIP_HEADER(From),#,1),:, 2)})
exten => _X.,n,Set(__DOLI_CALLE=${CUT(CUT(SIP_HEADER(To),#,1),:, 2)})
[macro-dolinotif]
exten => s,1,SET(${CURL(https://url.com/htdocs/custom/calling/calling.php?account=${EXTEN}&caller=${DOLI_CALLER}&callee=${DOLI_CALLE}&type=CONNECT&callref=${DOLI_CALLER}&version=1)})
[dolibarr_notification]
exten => s,1,SET(CALLERID(name)=${CURL(https://url.com/htdocs/custom/calling/calling.php?account=${USERNAME}&caller=${DOLI_CALLER}&callee=${DOLI_CALLE}&type=SETUP&callref=${DOLI_CALLER}&version=1)})
exten => s,n,Answer()
exten => s,n,Dial(SIP/MY_NUMBER,60,etTrM(dolinotif))
exten => h,1,SET(CALLERID(name)=${CURL(https://url.com/htdocs/custom/calling/calling.php?account=${USERNAME}&caller=${DOLI_CALLER}&callee=${DOLI_CALLE}&type=RELEASE&callref=${DOLI_CALLER}&version=1)})
exten => h,2,Hangup(16)
I'm a begineer on Asterisk, maybe it's just a dumb problem... If you need more informations ask me.
Thank a lot.
Use older asterisk version or rewrite your dialplan to use Gosub instead of macros.
In my asterisk extension I had wrote like this
[callback]
exten => Set(FROM=${CALLERID(num)})
exten => 2020,1,Answer()
exten => 2020,n,GotoIf(callback)
exten => 2020,n(callback),System(/etc/asterisk/scripts/callback)
exten => 2020,n,Hangup()
exten => 1111,1,Answer()
exten => 1222,1,Dial(SIP/2000) ;here instead of 2000 I want to bring callerid number FROM
exten => 1222,n,Hangup()
When I give SIP/2000 everything is working fine after I give miss call to 2020 I am able to get call.
But when I give like this SIP/$FROM its not working. CallerID number is coming blank.
Can anyone help me to solve this problem
On Asterisk 1.2 or higher, replace the 2nd line with:
exten => Set(FROM=${CALLERID(num)},g)
On Asterisk 1.0 or 1.1, replace the 2nd line with:
exten => SetGlobalVar(FROM=${CALLERID(num)})
I want to trigger an AGI script (to activate a door opener) while calling. Preferably the script executes on pressing the #-key.
How to embed this behavior in a dialplan? All examples I have found are not dependent on a key press.
I am using FreePBX 2.8.1.4. This is what I have tried:
exten => s,1,Wait(1)
exten => s,n,AGI(test.py)
exten => s,n,Dial(SIP/mk55/203,20,tr)
exten => #,n,AGI(/home/pi/.scripts/dooropen.py)
exten => s,n,Hangup()
and this:
exten => s,n,Read(inPut,,1)
exten => s,n,Dial(console/dsp)
exten => s,n,GotoIf($["${inPut}" = "#"]?keypressed,1)
exten => keypressed,1,AGI(/home/pi/.scripts/dooropen.py)
exten => s,4,Hangup
In deed AGI(script_name, args...) is the right application to use https://wiki.asterisk.org/wiki/display/AST/Application_AGI
To retrieve a DTMF press you can use WaitExten https://wiki.asterisk.org/wiki/display/AST/Application_WaitExten
You can find here a sample of WaitExten usage
Seek Help concerning IVR Menu in Asterisk
Regards
I have an Asterisk server that I need to reconfigure. It was built by an outside contractor, and I need to make some changes to it. Right now, all it does is answer a call, accept a 7-digit code, and hang up. On the back end, it records the timestamp of the call, the caller id, and the 7-digit code.
What we are running into is that some people do not enter in the 7-digit password, or they take too long. Then the system just restarts, and will continue in an endless loop, until they enter in 7-digits. The callers are, as of late, thinking that the system is broken, when they do not enter in a 7-digit code.
What I'm trying to figure out how to do is that when the system has to return to the beginning, it might say something like "you only entered 6 digits. pleas try again." Or something to that effect. I'm not 100% sure how to add this into the current configuration. Below is what we currently have:
[inbound]
exten => 1234567890,1,Answer
exten => 1234567890,2,Set(COUNTER=4)
exten => 1234567890,3,Set(COUNTER=$[${COUNTER} -1 ])
exten => 1234567890,4,NoOp(${COUNTER})
exten => 1234567890,5,GotoIf($[${COUNTER} > 0 ]?10:122)
exten => 1234567890,10,Wait(1)
exten => 1234567890,11,read(SCODE,EnterCode,7,)
exten => 1234567890,12,GotoIf($[${LEN(${SCODE})}=7]?13:3)
exten => 1234567890,13,Playback(YouEntered)
exten => 1234567890,n,SayDigits(${SCODE})
exten => 1234567890,n,read(SCHOICE,correctpressone,1,)
exten => 1234567890,n,Gotoif($[ ${SCHOICE} = 1 ]?20:1)
exten => 1234567890,20,NoOp(${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)} ${SCODE} ${CALLERID(num)})
exten => 1234567890,n,TrySystem(/bin/echo ${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}, ${SCODE}, ${CALLERID(num)} >> /opt/codes.log)
exten => 1234567890,n,Playback(SuccessfullyActivate)
exten => 1234567890,n,Hangup()
exten => 1234567890,122,Playback(tt-somethingwrong)
exten => 1234567890,n,Hangup()
Thanks for any help with this issue...
Something like this:
exten => 1234567890,12,GotoIf($[${LEN(${SCODE})}=7]?13:200)
exten => 1234567890,200,Playback(your_inpout_too_short)
exten => 1234567890,201,Goto(3)
Btw, you dialplan is poor quality,looks like person who did it also have no experience.