Where in the dialplan can I get extension and callerid?

cvschleich

Member
Joined
Dec 17, 2007
Messages
55
Reaction score
0
[SOLVED] Where in the dialplan can I get extension and callerid?

I need to trigger an external event when an extension answers an incoming line from a zap channel. Can anyone help me kn where in the dialplan to insert some instructions *AFTER* the extension picks up the call?

Code:
[Apr 18 12:23:13] VERBOSE[9108] logger.c:     -- SIP/102-09308b88 is ringing
[Apr 18 12:23:15] VERBOSE[9108] logger.c:     -- Zap/7-1 is ringing
[Apr 18 12:23:15] VERBOSE[9108] logger.c:     -- SIP/102-09308b88 answered Zap/6-1
[Apr 18 12:23:15] VERBOSE[9108] logger.c:     -- Hungup 'Zap/7-1'
[Apr 18 12:23:15] VERBOSE[9108] logger.c:     -- Executing [s@macro-auto-blkvm:1] Set("SIP/102-09308b88", "__MACRO_RESULT=") in new stack
[Apr 18 12:23:15] DEBUG[9108] app_macro.c: Executed application: Set
[Apr 18 12:23:15] VERBOSE[9108] logger.c:     -- Executing [s@macro-auto-blkvm:2] Set("SIP/102-09308b88", "__CWIGNORE=") in new stack
[Apr 18 12:23:15] DEBUG[9108] app_macro.c: Executed application: Set
[Apr 18 12:23:15] VERBOSE[9108] logger.c:     -- Executing [s@macro-auto-blkvm:3] DBdel("SIP/102-09308b88", "BLKVM/600/Zap/6-1") in new stack
[Apr 18 12:23:15] VERBOSE[9108] logger.c:     -- DBdel: family=BLKVM, key=600/Zap/6-1
[Apr 18 12:23:15] DEBUG[9108] app_macro.c: Executed application: DBDel
Can I safely hijack the macro-auto-blkvm macro?

Thanks!

EDIT: The external procedure needs to know the extension and the cid data. Thx!
 
Hi

If you copy the context you want to hijack and paste it into the extensions freePBX override conf file, then do your modifications in there.

These modifications will get left alone during upgrades, and the nature of asterisk is that it will load in the first context it sees, and ignore subsequent contexts with the same name.

The override files are parsed first by Asterisk, before extensions.conf, extensions_additional.conf etc.

Yours

Joe
 
Thanks, Joe. I've done that, and I have the script running with a simple verbose to the console. The problem I'm having now is how do I get at variables for extension and cid. I think the trouble I'm having is not knowing the current correct syntax for accessing the variables. The script seems to bomb when I try to get at them, and I'm not sure where the STDERR output is going...

2 questions:

Where is the best information about programming AGI for Asterisk 1.4? I can't seem to find a definitive source of information. I must be overlooking something obvious, but I'm currently at a loss.

What is the preferred language and library for programming AGI, PHP? Perl? Something else? I'm quite capable with either language, and willing to look into others as necessary.

All opinions are welcome!

Thanks, all!
 
Sorry, the limit of my knowledge was a handful of shell scripts to make PiaF work, and an understanding of telephony.

My understanding is that that the language does not really matter too much. Whatever you are comfortable with; within reason.

You have the option at the Asterisk CLI - agi debug, which may help. The ones used for A2Billing write logs as they go by means of logging set up within the script.

Voip-info seems to be the favourite place to go and look for information regarding variables. Here would be a good place to start:-

http://www.voip-info.org/wiki/index.php?page=Asterisk+variables

Joe
 
Here's how I did it:

in extensions_override_freepbx.conf:
Code:
[macro-auto-blkvm]
exten => s,1,Set(__MACRO_RESULT=)
exten => s,n,Set(__CWIGNORE=)
exten => s,n,DBDel(${BLKVM_OVERRIDE})
exten => s,n,NoOp(Kicking off ali.php...)
exten => s,n,AGI(ali.php|${CALLERID(ANI)}|${CHANNEL})
The only difference from the original macro-auto-blkvm is that I added the bottom two lines. My biggest struggle was finding the correct variables to send along, since agi_callerid had the ring group number in it, and agi_extension was s.

This got what I needed into ali.php as $argv[1] and $argv[2].

Thanks for the pointers, Joe!
 

Members online

Forum statistics

Threads
26,688
Messages
174,412
Members
20,259
Latest member
Fadeek86
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Back
Top