ballsimtall
New Member
- Joined
- Sep 1, 2013
- Messages
- 3
- Reaction score
- 0
From: http://www.reddit.com/r/Asterisk/comments/1llqhu/run_system_script_based_on_caller_id_without/ (I hope I can get a 2nd opinion from you guys)
This is what I want to do: Depending on who is calling my cell phone, I want to run a different shell script.
My setup: I use freebpx with google voice. Google voice has the ability to call many phones at the same time from one number. Whichever phone picks up the call first will receive the call. I have it so Google voice will call my cell phone and my freepbx at the same time. What I want to happen is that while both phones are ringing, my freepbx will detect the caller ID and be able to run a system script but never actually answer the call. This will allow my cell phone to keep ringing so I can answer the call on my cell phone. The way I have it set up now, freepbx will run the script based on caller ID but it will pick up the call in order to do so, in turn never giving my cell phone a chance to ring.
My extensions_custom.conf file:
;# // BEGIN Thing by CID
exten => 4788,1,Ringing
exten => 4788,2,NoOp(${CALLERID})
exten => 4788,3,System(/root/scripts/thing)
;# // END Thing by CID
;# // BEGIN Thing2 by CID
exten => 4777,1,Ringing
exten => 4777,2,NoOp(${CALLERID})
exten => 4777,3,System(/root/scripts/thing2)
;# // END Thing2 by CID
My freepbx config: Under Admin -> Custom Extentions, I added thing1 and thing 2 Under Admin -> Add Misc Destination, I added thing 1 and thing 2
Under connectivity -> inbound routes I setup two different routes based on caller id to run each extension by going under Set destination -> misc destination and choosing the corresponding "thing" to run.
How can I get the Thing script to run while still ringing my cell phone?
extensions.conf: http://pastebin.com/71aPTyab
extensions_custom.conf: http://pastebin.com/erAhw7DP
UPDATE:
I found the file /etc/asterisk/extensions_additional.conf: At the end of the file reads:
[im-myemailaddressgmailcom]
include => im-myemailaddressgmailcom-custom
exten => s,1(1),Noop(Receiving GoogleVoice on DID: ***My GVoice# was here***)
exten => s,n,Noop(${EXTEN})
exten => s,n,Set(CALLERID(name)=${CUT(CALLERID(name),@,1)})
exten => s,n,GotoIf($["${CALLERID(name):0:2}" != "+1"]?nextstop)
exten => s,n,Set(CALLERID(name)=${CALLERID(name):2})
exten => s,n(nextstop),GotoIf($["${CALLERID(name):0:1}" != "+"]?notrim)
exten => s,n,Set(CALLERID(name)=${CALLERID(name):1})
exten => s,n(notrim),Set(CALLERID(number)=${CALLERID(name)})
exten => s,n,Wait(1) exten => s,n,Answer exten => s,n,SendDTMF(1)
exten => s,n,Goto(from-trunk,***My GVoice # was here***,1)
exten => h,1,Hangup
;--== end of [im-myemailaddressgmailcom] ==--;
So I changed it to:
[im-myemailaddressgmailcom]
exten => s,1,System(/root/scripts/thing)
exten => s,n,Congestion
exten => h,1,Hangup
;--== end of [im-myemailaddressgmailcom] ==--;
And everything ALMOST worked the way I want it!!!!
Problem one: I think this file gets executed no matter what CID is calling. This means I can not make a custom [im-myemailaddressgmailcom] that has a different thing script depending on who is calling. No problem I suppose. Ill just tweak my script to accept parameters and do something like:
[im-myemailaddressgmailcom]
exten => s,1,System(/root/scripts/thingthattakesparams ${CALLERID})
exten => s,n,Congestion
exten => h,1,Hangup
;--== end of [im-myemailaddressgmailcom] ==--;
Correct?
Problem two: At the top of /etc/asterisk/extensions_additional.conf reads:
Do NOT edit this file as it is auto-generated by FreePBX. All modifications to this file must be done via the web gui. There are alternative files to make custom modifications, details at: http://freepbx.org/configuration_files
I take it this means that my changes will get overwritten whenever I restart the PBX? Do you know how I can fix this? Do I need to put [im-myemailaddressgmailcom] somewhere else? If so, how do I make sure it is the very first thing that will run? Is there a better alternative to how I am doing this? Thanks for the help!
This is what I want to do: Depending on who is calling my cell phone, I want to run a different shell script.
My setup: I use freebpx with google voice. Google voice has the ability to call many phones at the same time from one number. Whichever phone picks up the call first will receive the call. I have it so Google voice will call my cell phone and my freepbx at the same time. What I want to happen is that while both phones are ringing, my freepbx will detect the caller ID and be able to run a system script but never actually answer the call. This will allow my cell phone to keep ringing so I can answer the call on my cell phone. The way I have it set up now, freepbx will run the script based on caller ID but it will pick up the call in order to do so, in turn never giving my cell phone a chance to ring.
My extensions_custom.conf file:
;# // BEGIN Thing by CID
exten => 4788,1,Ringing
exten => 4788,2,NoOp(${CALLERID})
exten => 4788,3,System(/root/scripts/thing)
;# // END Thing by CID
;# // BEGIN Thing2 by CID
exten => 4777,1,Ringing
exten => 4777,2,NoOp(${CALLERID})
exten => 4777,3,System(/root/scripts/thing2)
;# // END Thing2 by CID
My freepbx config: Under Admin -> Custom Extentions, I added thing1 and thing 2 Under Admin -> Add Misc Destination, I added thing 1 and thing 2
Under connectivity -> inbound routes I setup two different routes based on caller id to run each extension by going under Set destination -> misc destination and choosing the corresponding "thing" to run.
How can I get the Thing script to run while still ringing my cell phone?
extensions.conf: http://pastebin.com/71aPTyab
extensions_custom.conf: http://pastebin.com/erAhw7DP
UPDATE:
I found the file /etc/asterisk/extensions_additional.conf: At the end of the file reads:
[im-myemailaddressgmailcom]
include => im-myemailaddressgmailcom-custom
exten => s,1(1),Noop(Receiving GoogleVoice on DID: ***My GVoice# was here***)
exten => s,n,Noop(${EXTEN})
exten => s,n,Set(CALLERID(name)=${CUT(CALLERID(name),@,1)})
exten => s,n,GotoIf($["${CALLERID(name):0:2}" != "+1"]?nextstop)
exten => s,n,Set(CALLERID(name)=${CALLERID(name):2})
exten => s,n(nextstop),GotoIf($["${CALLERID(name):0:1}" != "+"]?notrim)
exten => s,n,Set(CALLERID(name)=${CALLERID(name):1})
exten => s,n(notrim),Set(CALLERID(number)=${CALLERID(name)})
exten => s,n,Wait(1) exten => s,n,Answer exten => s,n,SendDTMF(1)
exten => s,n,Goto(from-trunk,***My GVoice # was here***,1)
exten => h,1,Hangup
;--== end of [im-myemailaddressgmailcom] ==--;
So I changed it to:
[im-myemailaddressgmailcom]
exten => s,1,System(/root/scripts/thing)
exten => s,n,Congestion
exten => h,1,Hangup
;--== end of [im-myemailaddressgmailcom] ==--;
And everything ALMOST worked the way I want it!!!!
Problem one: I think this file gets executed no matter what CID is calling. This means I can not make a custom [im-myemailaddressgmailcom] that has a different thing script depending on who is calling. No problem I suppose. Ill just tweak my script to accept parameters and do something like:
[im-myemailaddressgmailcom]
exten => s,1,System(/root/scripts/thingthattakesparams ${CALLERID})
exten => s,n,Congestion
exten => h,1,Hangup
;--== end of [im-myemailaddressgmailcom] ==--;
Correct?
Problem two: At the top of /etc/asterisk/extensions_additional.conf reads:
Do NOT edit this file as it is auto-generated by FreePBX. All modifications to this file must be done via the web gui. There are alternative files to make custom modifications, details at: http://freepbx.org/configuration_files
I take it this means that my changes will get overwritten whenever I restart the PBX? Do you know how I can fix this? Do I need to put [im-myemailaddressgmailcom] somewhere else? If so, how do I make sure it is the very first thing that will run? Is there a better alternative to how I am doing this? Thanks for the help!