Call Pickup with *8# : agi_callerid gone?


#1

I have the following situation:

Asterisk with a zaphfc BRI card and 5 SIP phones (1001-1005).
When a call comes in on the BRI, 1001 and 1002 are going to ring -->

s,3,Dial(sip/1001&sip/1002)

When one of them picks up, an AGI script takes a few variables such as callerid and uniqueid, and netcats them to an MS Access application.

This is the output of an AGI debug when 1001 or 1002 pick up:

AGI Tx >> agi_request: schrijfextensie.sh
AGI Tx >> agi_channel: SIP/1002-836e
AGI Tx >> agi_language: nl
AGI Tx >> agi_type: SIP
AGI Tx >> agi_uniqueid: asterisk-31500-1136389501.1136
AGI Tx >> agi_callerid: 0647174820
AGI Tx >> agi_dnid: unknown
AGI Tx >> agi_rdnis: unknown
AGI Tx >> agi_context: macro-schrijfextensie
AGI Tx >> agi_extension: s
AGI Tx >> agi_priority: 2
AGI Tx >> agi_enhanced: 0.0
AGI Tx >> agi_accountcode:
AGI Tx >>

Where 0647174820 is my cellphone calling to the BRI line.

But, here’s the problem. When 1001 and 1002 ring, and 1003 picks up the call with *8#, the AGI debug output looks like this:

AGI Tx >> agi_request: schrijfextensie.sh
AGI Tx >> agi_channel: SIP/1003-7d67
AGI Tx >> agi_language: nl
AGI Tx >> agi_type: SIP
AGI Tx >> agi_uniqueid: asterisk-31500-1136389401.1132
AGI Tx >> agi_callerid: 1003
AGI Tx >> agi_dnid: *8
AGI Tx >> agi_rdnis: unknown
AGI Tx >> agi_context: macro-schrijfextensie
AGI Tx >> agi_extension: s
AGI Tx >> agi_priority: 2
AGI Tx >> agi_enhanced: 0.0
AGI Tx >> agi_accountcode:
AGI Tx >>

Obviously, my Access app, which kind of relies on agi_callerid, doesn’t know what to do with this call. Is there any way to get the agi_callerid set to the original callerid? I have tried working with a global variable, but that doesn’t work when there are more than one calls at the same time.

Thanks for your info!


#2

ahem, little kick

Where can I begin to look?


#3

could you, first thing, store the callerid into a new variable using the ${UNIQUEID} variable (voip-info.org/wiki/view/Asterisk+variables) as part of the variable name? does asterisk support variable variable names?

so, call comes in and first thing you do is (please forgive that this syntax is not correct):

SetVar($[${UNIQUEID}]_callerid=${CALLERID})

Assuming the uniqueid is 3435F34F4F, then later on you reference the variable ${3435F34F4F_callerid} instead of ${CALLERID}