[HELP] UserEvent and Default Channel Variables


#1

I am trying to create a UserEvent to fire off that will basically contain the following information right before the phones ring (or even just as they begin ringing) and then again as soon as the call is linked:

[ul]1. SourceUniqueID
2. SourceChannel
3. SourceCallerIDNumber
4. DestUniqueID
5. DestChannel
6. DestCallerIDNumber[/ul]
I COULD use the Dial and Link events but those don’t contain all 6 pieces of information and I would really like to have a single event that contains all of the information rather than having to write a lot of code to piece all of the information together.

Ideally, I’d like to send that user event with something like the following command:

exten=>537,n,UserEvent(Ring|SourceID: ${UNIQUEID}|DestinationID: ${DESTUNIQUEID}|SourceChannel: ${CHANNEL}|DestinationChannel: ${DESTCHANNEL}|SourceCallerID: ${CALLERIDNUMBER}|DestinationCallerID: ${DESTCALLERIDNUMBER})
More realistically, this is as close as I’ve been able to figure out so far:

exten=>537,n,UserEvent(Ring|SourceID: ${UNIQUEID}|DestinationID: ?????????|SourceChannel: CDR(channel)|DestinationChannel: ?????????||SourceCallerID: CDR(src)|DestinationCallerID: CDR(dst))
How do I get the other pieces of information for the destination channel to add to my user event? And are there better ways to get the pieces of information I have than what I have posted?

Thanks!


#2

Here is what my extensions.conf looks like in this area:

exten=>537,1,Wait(1) exten=>537,n,UserEvent(Ring|SourceID: ${UNIQUEID}|DestinationID: ${DESTUNIQUEID}|SourceChannel: ${CHANNEL}|DestinationChannel: ${DESTCHANNEL}|SourceCallerID: ${CALLERIDNUMBER}|DestinationCallerID: ${DESTCALLERIDNUMBER}) exten=>537,n,Dial(SIP/537,20,t) exten=>537,n,Voicemail,u537 exten=>537,n,Hangup

Note that I have tried using CDR(dstuniqueid) but it is always blank before the Dial command. But if I put it after the Dial command, it never gets called until/unless the person at x537 doesn’t pick up the phone BUT if that happens, then it is no longer blank. I guess I’m confused as to when the variables actually become populated. Is there anyway that I can do this from inside the Dial command? And still, how do I get the destination unique ID?