Discussion:
[Freeswitch-users] Exporting Diversion Header Twice
Sanjiv Kumar
2014-04-22 16:40:58 UTC
Permalink
I am trying to export sip_h_Diversion header twice but I only see the last
attempt on leg-B. It appears that second export attempt overwrites the first
one.



How can I export it twice?



<extension name="public_did">

<condition field="destination_number" expression="^9999(\d{10})$">



<action application="set" data="ocn=18005551212"/>

<action application="set" data="rdn=18005552323"/>



<action application="export" data=" nolocal:sip_h_Diversion
=<sip:${ocn}@${network_addr}>;reason=user-busy;counter=3;privacy=off"/>

<action application="export" data=" nolocal:sip_h_Diversion
=<sip:${rdn}@${network_addr}>;reason=no-answer;counter=1;privacy=off"/>



<action application="set" data="hangup_after_bridge=true" />

<action application="set" data="continue_on_fail=true"/>



<action application="transfer" data="1001 XML default"/>

</condition>

</extension>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20140422/358c4663/attachment.html
Sanjiv Kumar
2014-04-22 19:24:45 UTC
Permalink
Anyone ?? At least let me know if this cannot be done.





I am trying to export sip_h_Diversion header twice but I only see the last
attempt on leg-B. It appears that second export attempt overwrites the first
one.



How can I export it twice?



<extension name="public_did">

<condition field="destination_number" expression="^9999(\d{10})$">



<action application="set" data="ocn=18005551212"/>

<action application="set" data="rdn=18005552323"/>



<action application="export" data=" nolocal:sip_h_Diversion
Post by Sanjiv Kumar
;reason=user-busy;counter=3;privacy=off"/>
<action application="export" data=" nolocal:sip_h_Diversion
Post by Sanjiv Kumar
;reason=no-answer;counter=1;privacy=off"/>
<action application="set" data="hangup_after_bridge=true" />

<action application="set" data="continue_on_fail=true"/>



<action application="transfer" data="1001 XML default"/>

</condition>

</extension>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20140422/b395b8b2/attachment.html
Dahlberg, David
2014-04-23 07:05:08 UTC
Permalink
Post by Sanjiv Kumar
I am trying to export sip_h_Diversion header twice but I only see the
last attempt on leg-B. It appears that second export attempt
overwrites the first one.
[..]
(A) In Freeswitch/Sofia SIP you're not actually writing a header, but
you're writing a variable that in turn will tell mod_sofia to write a
header. If you write to the same variable a second time, you will
overwrite it.

(B) Sip (as good old RFC 822) allows for multiple headers in in multiple
formats. One possibility is actually adding multiple headers, the other
is having one header with multiple values, separated by comma.

So please try the following: Set the variable once, but with both
values, separated by comma. The result will be, that mod_sophia adds
indeed two separate headers.

Cheers
David
--
David Dahlberg

Fraunhofer FKIE, Dept. Communication Systems (KOM) | Tel: +49-228-9435-845
Fraunhoferstr. 20, 53343 Wachtberg, Germany | Fax: +49-228-856277
Steven Ayre
2014-04-23 09:55:37 UTC
Permalink
You could also try whether mod_sofia supports arrays for that variable

http://wiki.freeswitch.org/wiki/Dialplan_ARRAYS



On 23 April 2014 08:05, Dahlberg, David
Post by Dahlberg, David
Post by Sanjiv Kumar
I am trying to export sip_h_Diversion header twice but I only see the
last attempt on leg-B. It appears that second export attempt
overwrites the first one.
[..]
(A) In Freeswitch/Sofia SIP you're not actually writing a header, but
you're writing a variable that in turn will tell mod_sofia to write a
header. If you write to the same variable a second time, you will
overwrite it.
(B) Sip (as good old RFC 822) allows for multiple headers in in multiple
formats. One possibility is actually adding multiple headers, the other
is having one header with multiple values, separated by comma.
So please try the following: Set the variable once, but with both
values, separated by comma. The result will be, that mod_sophia adds
indeed two separate headers.
Cheers
David
--
David Dahlberg
Fraunhofer FKIE, Dept. Communication Systems (KOM) | Tel: +49-228-9435-845
Fraunhoferstr. 20, 53343 Wachtberg, Germany | Fax: +49-228-856277
_________________________________________________________________________
consulting at freeswitch.org
http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server
http://www.cudatel.com
Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com
FreeSWITCH-users mailing list
FreeSWITCH-users at lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20140423/dbe8efbd/attachment.html
Brian West
2014-04-23 12:53:57 UTC
Permalink
I?m not sure you can add two headers currently, smells like a feature request but the array method would be how it would have to be done.

--
Brian West
brian at freeswitch.org
FreeSWITCH Solutions, LLC
PO BOX 2531
Brookfield, WI 53008-2531
Twitter: @FreeSWITCH , @briankwest
http://www.freeswitchbook.com
http://www.freeswitchcookbook.com

T: +1.918.420.9001 | F: +1.918.420.9002 | M: +1.918.424.WEST
iNUM: +883 5100 1420 9001
ISN: 410*543
Skype:briankwest
PGP Key: http://www.bkw.org:81/key.txt (AB93356707C76CED)
Post by Steven Ayre
You could also try whether mod_sofia supports arrays for that variable
http://wiki.freeswitch.org/wiki/Dialplan_ARRAYS
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 841 bytes
Desc: Message signed with OpenPGP using GPGMail
Url : http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20140423/1f025a08/attachment.bin
Michael Jerris
2014-04-23 14:14:53 UTC
Permalink
comma separated multiple values should work fine now. In sip those are the same as multiple of the same header.
Post by Brian West
I?m not sure you can add two headers currently, smells like a feature request but the array method would be how it would have to be done.
--
Brian West
brian at freeswitch.org
FreeSWITCH Solutions, LLC
PO BOX 2531
Brookfield, WI 53008-2531
http://www.freeswitchbook.com
http://www.freeswitchcookbook.com
T: +1.918.420.9001 | F: +1.918.420.9002 | M: +1.918.424.WEST
iNUM: +883 5100 1420 9001
ISN: 410*543
Skype:briankwest
PGP Key: http://www.bkw.org:81/key.txt (AB93356707C76CED)
Post by Steven Ayre
You could also try whether mod_sofia supports arrays for that variable
http://wiki.freeswitch.org/wiki/Dialplan_ARRAYS
_________________________________________________________________________
consulting at freeswitch.org
http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server
http://www.cudatel.com
Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com
FreeSWITCH-users mailing list
FreeSWITCH-users at lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
Sanjiv Kumar
2014-04-23 22:48:09 UTC
Permalink
I have tried following three options and I don?t multiple diversion header.



OPTION 1

If I use ?push? application, I get the diversion field like below

Diversion: ARRAY::<sip:18005551212 at 10.10.10.10>;reason=user-busy;counter=3;privacy=off|:<sip:18005552323>;reason=no-answer;counter=1;privacy=off



<extension name="public_did">

<condition field="destination_number" expression="^9999(\d{10})$">



<action application="set" data="ocn=18005551212"/>

<action application="set" data="rdn=18005552323"/>



<action application="push" data="sip_h_Diversion =<sip:${ocn}@${network_addr} <sip:$%7bocn%7d@$%7bnetwork_addr%7d> >;reason=user-busy;counter=3;privacy=off"/>

<action application="push" data="sip_h_Diversion =<sip:${rdn}@${network_addr} <sip:$%7brdn%7d@$%7bnetwork_addr%7d> >;reason=no-answer;counter=1;privacy=off"/>



<action application="set" data="hangup_after_bridge=true" />

<action application="set" data="continue_on_fail=true"/>



<action application="transfer" data="1001 XML default"/>

</condition>

</extension>





OPTION 2

If I use export with ?,? then I get the following results:

Diversion: <sip:19082302337 at 216.1.185.103>;reason=user-busy;counter=3;privacy=off,<sip:13216938059 at 216.1.185.103>;reason=no-answer;counter=1;privacy=off



<extension name="public_did">

<condition field="destination_number" expression="^9999(\d{10})$">



<action application="set" data="ocn=18005551212"/>

<action application="set" data="rdn=18005552323"/>



<action application="export" data="sip_h_Diversion =<sip:${ocn}@${network_addr} <sip:$%7bocn%7d@$%7bnetwork_addr%7d> >;reason=user-busy;counter=3;privacy=off, <sip:${rdn}@${network_addr} <sip:$%7brdn%7d@$%7bnetwork_addr%7d> >;reason=no-answer;counter=1;privacy=off "/>



<action application="set" data="hangup_after_bridge=true" />

<action application="set" data="continue_on_fail=true"/>



<action application="transfer" data="1001 XML default"/>

</condition>

</extension>





OPTION 3

Setting a specific array element I get the following result



Diversion: ARRAY::<sip:19082302337 at 216.1.185.103>;reason=user-busy;counter=3;privacy=off}|:<sip:13216938059 at 216.1.185.103>;reason=no-answer;counter=1;privacy=off

<extension name="public_did">

<condition field="destination_number" expression="^9999(\d{10})$">



<action application="set" data="ocn=18005551212"/>

<action application="set" data="rdn=18005552323"/>



<action application="set" data="sip_h_Diversion[0] =<sip:${ocn}@${network_addr} <sip:$%7bocn%7d@$%7bnetwork_addr%7d> >;reason=user-busy;counter=3;privacy=off"/>

<action application="set" data="sip_h_Diversion[1] =<sip:${rdn}@${network_addr} <sip:$%7brdn%7d@$%7bnetwork_addr%7d> >;reason=no-answer;counter=1;privacy=off"/>



<action application="set" data="hangup_after_bridge=true" />

<action application="set" data="continue_on_fail=true"/>



<action application="transfer" data="1001 XML default"/>

</condition>

</extension>

















From: Steven Ayre [mailto:steveayre at gmail.com]
Sent: Wednesday, April 23, 2014 5:56 AM
To: FreeSWITCH Users Help
Subject: Re: [Freeswitch-users] Exporting Diversion Header Twice



You could also try whether mod_sofia supports arrays for that variable



http://wiki.freeswitch.org/wiki/Dialplan_ARRAYS
Post by Sanjiv Kumar
I am trying to export sip_h_Diversion header twice but I only see the
last attempt on leg-B. It appears that second export attempt
overwrites the first one.
[..]
Post by Sanjiv Kumar
<action application="export" data=" nolocal:sip_h_Diversion =<sip: <sip:%0b>
<action application="export" data=" nolocal:sip_h_Diversion =<sip: <sip:%0b>
(A) In Freeswitch/Sofia SIP you're not actually writing a header, but
you're writing a variable that in turn will tell mod_sofia to write a
header. If you write to the same variable a second time, you will
overwrite it.

(B) Sip (as good old RFC 822) allows for multiple headers in in multiple
formats. One possibility is actually adding multiple headers, the other
is having one header with multiple values, separated by comma.

So please try the following: Set the variable once, but with both
values, separated by comma. The result will be, that mod_sophia adds
indeed two separate headers.

Cheers
David

--
David Dahlberg

Fraunhofer FKIE, Dept. Communication Systems (KOM) | Tel: +49-228-9435-845 <tel:%2B49-228-9435-845>
Fraunhoferstr. 20, 53343 Wachtberg, Germany | Fax: +49-228-856277 <tel:%2B49-228-856277>
_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting at freeswitch.org
http://www.freeswitchsolutions.com

FreeSWITCH-powered IP PBX: The CudaTel Communication Server
http://www.cudatel.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users at lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20140423/7ffda400/attachment-0001.html
Michael Jerris
2014-04-24 12:28:55 UTC
Permalink
Option 2 should work fine.
Post by Sanjiv Kumar
I have tried following three options and I don?t multiple diversion header.
OPTION 1
If I use ?push? application, I get the diversion field like below
Diversion: ARRAY::<sip:18005551212 at 10.10.10.10>;reason=user-busy;counter=3;privacy=off|:<sip:18005552323>;reason=no-answer;counter=1;privacy=off
<extension name="public_did">
<condition field="destination_number" expression="^9999(\d{10})$">
<action application="set" data="ocn=18005551212"/>
<action application="set" data="rdn=18005552323"/>
<action application="set" data="hangup_after_bridge=true" />
<action application="set" data="continue_on_fail=true"/>
<action application="transfer" data="1001 XML default"/>
</condition>
</extension>
OPTION 2
Diversion: <sip:19082302337 at 216.1.185.103>;reason=user-busy;counter=3;privacy=off,<sip:13216938059 at 216.1.185.103>;reason=no-answer;counter=1;privacy=off
<extension name="public_did">
<condition field="destination_number" expression="^9999(\d{10})$">
<action application="set" data="ocn=18005551212"/>
<action application="set" data="rdn=18005552323"/>
<action application="set" data="hangup_after_bridge=true" />
<action application="set" data="continue_on_fail=true"/>
<action application="transfer" data="1001 XML default"/>
</condition>
</extension>
OPTION 3
Setting a specific array element I get the following result
Diversion: ARRAY::<sip:19082302337 at 216.1.185.103>;reason=user-busy;counter=3;privacy=off}|:<sip:13216938059 at 216.1.185.103>;reason=no-answer;counter=1;privacy=off
<extension name="public_did">
<condition field="destination_number" expression="^9999(\d{10})$">
<action application="set" data="ocn=18005551212"/>
<action application="set" data="rdn=18005552323"/>
<action application="set" data="hangup_after_bridge=true" />
<action application="set" data="continue_on_fail=true"/>
<action application="transfer" data="1001 XML default"/>
</condition>
</extension>
From: Steven Ayre [mailto:steveayre at gmail.com]
Sent: Wednesday, April 23, 2014 5:56 AM
To: FreeSWITCH Users Help
Subject: Re: [Freeswitch-users] Exporting Diversion Header Twice
You could also try whether mod_sofia supports arrays for that variable
http://wiki.freeswitch.org/wiki/Dialplan_ARRAYS
Post by Sanjiv Kumar
I am trying to export sip_h_Diversion header twice but I only see the
last attempt on leg-B. It appears that second export attempt
overwrites the first one.
[..]
(A) In Freeswitch/Sofia SIP you're not actually writing a header, but
you're writing a variable that in turn will tell mod_sofia to write a
header. If you write to the same variable a second time, you will
overwrite it.
(B) Sip (as good old RFC 822) allows for multiple headers in in multiple
formats. One possibility is actually adding multiple headers, the other
is having one header with multiple values, separated by comma.
So please try the following: Set the variable once, but with both
values, separated by comma. The result will be, that mod_sophia adds
indeed two separate headers.
Cheers
David
--
David Dahlberg
Fraunhofer FKIE, Dept. Communication Systems (KOM) | Tel: +49-228-9435-845
Fraunhoferstr. 20, 53343 Wachtberg, Germany | Fax: +49-228-856277
_________________________________________________________________________
consulting at freeswitch.org
http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server
http://www.cudatel.com
Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com
FreeSWITCH-users mailing list
FreeSWITCH-users at lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
_________________________________________________________________________
consulting at freeswitch.org
http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server
http://www.cudatel.com
Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com
FreeSWITCH-users mailing list
FreeSWITCH-users at lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20140424/ec8bd553/attachment-0001.html
Loading...