Mike
2008-Jun-10 01:01 UTC
[asterisk-users] Asterisk : using setvar with IP Realtime and variable inheritance
Hi, I have what I think is a relatively advanced question. Any help is appreciated, even if it's not a complete answer. I am using Asterisk in mostly realtime fashion, specifically SIP registrations are in a MySQL table. This works fine (mostly). I also set a few variables in the setvar column, like this: callerid_internal=test <710>;did=5555551234 Again, this works fine. The problem is when I forward my calls to another outside line (using Polyocm phones), and need to know the ${did} value at that point. It's empty. In summary: Call comes in to extension 710 (let's say) This extension is forwarded to 5555557890 In my dial plan, when dialing 5555557890 I need to know the value of ${did}, but it's empty. If I hardcode this value in my dialplan using two underscores before it (i.e Setvar(__did=5555551234) ) this works. But I can't hardcode it, I need to fetch it from the table. And yes, I did try to append underscores before the word "did" in my table, but that didn't help. ANY help is greatly appreciated, I am completely stuck. Regards, Mick -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20080609/43e51836/attachment.htm
Tilghman Lesher
2008-Jun-10 02:50 UTC
[asterisk-users] Asterisk : using setvar with IP Realtime and variable inheritance
On Monday 09 June 2008 20:01:53 Mike wrote:> I have what I think is a relatively advanced question. Any help is > appreciated, even if it's not a complete answer. > > I am using Asterisk in mostly realtime fashion, specifically SIP > registrations are in a MySQL table. This works fine (mostly). I also set > a few variables in the setvar column, like this: > > callerid_internal=test <710>;did=5555551234 > > Again, this works fine. The problem is when I forward my calls to another > outside line (using Polyocm phones), and need to know the ${did} value at > that point. It's empty.Right, so the call path is: Provider -- Asterisk -- Polycom -- Asterisk--Provider The problem is that Polycom is in the call path. It doesn't know anything about Asterisk variables and so it doesn't pass them on. What you can do, however, is do the forwarding not within the phone, but within Asterisk itself, something like: exten => _*71NXX-NXX-XXXX,1,Set(DB(forward/myexten)=${EXTEN:3}) exten => *70,1,NoOp(${DB_DELETE(forward/myexten)}) and then in your dialplan: exten => 101,1,GotoIf($["${DB(forward/myexten)}" != ""]?forward) exten => 101,n,Dial(SIP/mypolycom) exten => 101,n,Voicemail(101,u) exten => 101,n,Hangup exten => 101,n(forward),Goto(outgoing,${DB(forward/myexten)},1) or something like that. -- Tilghman
David Backeberg
2008-Jun-10 13:21 UTC
[asterisk-users] Asterisk : using setvar with IP Realtime and variable inheritance
> callerid_internal=test <710>;did=5555551234 > Again, this works fine. The problem is when I forward my calls to another > outside line (using Polyocm phones), and need to know the ${did} value at > that point. It's empty.The other answer looks pretty good. If that doesn't work, do a sip debug on your console, and see if the values you want are in the traffic at all. You can set up some more complicated rules to parse your SIP headers if the values are just in a different field.
Leif Madsen
2008-Jun-10 13:34 UTC
[asterisk-users] Asterisk : using setvar with IP Realtime and variable inheritance
Mike wrote:> If I hardcode this value in my dialplan using two underscores before it (i.e > Setvar(__did=5555551234) ) this works. But I can't hardcode it, I need to > fetch it from the table.Have you tried: Set(__did=${did}) That might work. -- Leif Madsen http://www.leifmadsen.com http://www.oreilly.com/catalog/asterisk