help with dialplan condition based on agent

Status
Not open for further replies.

tjfayaz

New Member
Apr 20, 2021
15
1
3
46
Hi everyone, I have been trying with no success to find out how I can write a dialplan condition based on the agent field as shown in "sofia status profile internal reg". Basically I need to execute my script ONLY if the agent contains a specific string (in my case the string starts with iOS).

On top of this I also want it to execute this condition in the correct place so that I can delay the dialplan from ringing the agent for 2 seconds. I have not yet found the best place to put this using dialplan manager.

Any help or pointers would be much appreciated! Once I have cracked this I will be posting up a howto for IOS push notifications in fusionpbx.

for for example something like below

Code:
    <condition field="sofia_agent" expression="^([iOS])$">
        <action application="set" data="result=${system(/opt/push ${destination_number}@${domain_name} ${outbound_caller_id_number} ${outbound_caller_id_name})}"/>
        <action application="sleep" data="2000"/>
    </condition>
 
Last edited:

Adrian Fretwell

Well-Known Member
Aug 13, 2017
1,498
413
83
I'm not sure that sofia_agent is the right name to use, there is a channel variable called sip_user_agent.
 

tjfayaz

New Member
Apr 20, 2021
15
1
3
46
I'm not sure that sofia_agent is the right name to use, there is a channel variable called sip_user_agent.
Thanks Adrian, so now I have this, but it's where to put it! I tried putting it in the "local_extension" XML from dialplan manager but that does not work (it does not match so the condition is failing). If I remove the condition it works so I know my problem is the (a) the condition but also (b) where to put this so that it can delay the dialplan at the right point before ringing an extension.

Code:
    <condition field="${sip_user_agent}" expression="^([iOS])">
        <action application="set" data="result=${system(/opt/push ${destination_number}@${domain_name} ${outbound_caller_id_number} ${outbound_caller_id_name})}"/>
        <action application="sleep" data="2000"/>
    </condition>
 

tjfayaz

New Member
Apr 20, 2021
15
1
3
46
ok so I got it working, however I want to test the destination SIP user profile and there is no such variable! So basically I am going to have to think of a way to determine if the dialled extension is a particular agent based on the existing variables. In a basic way I could just say "any extension starting with an 8" is an iphone for example, but that's quite constraining.

I will work something out but in the meantime if any of you have any solutions or ideas please let me know?
 
Status
Not open for further replies.