Hi everyone!<br><br>In my environment I use FreeSwitch as media server and session border<br>controller. SIP routing is mostly done with my private B2BUA. The problem<br>itself is in my "hold" functionality. In details: A is calling to B:<br>
<br><!--<br> if the calling party is the called party, go to their VM <br> if the calling party is NOT the called party dial the extension<br> (1000-1019) for 30 seconds and go to voicemail if the<br> call fails (continue_on_fail=true), otherwise hang up after a<br>
successful bridge (hangup_after-bridge=true)<br>--><br><extension name="Local_Extension_from_SP"><br> <condition field="${sip_contact_uri}"<br>expression="^.*StarPound_.*_B2BUA.*$"/><br>
<condition field="destination_number" expression="^([0-9]{2,9})$"><br> <action application="set" data="dialed_extension=$1"/><br> <action application="export" data="dialed_extension=$1"/><br>
</condition><br> <condition field="${sip_to_host}" expression="^([^.]*)\..*$"><br> <action application="set" data="orgname=$1"/><br> </condition><br> <condition field="destination_number" expression="^${caller_id_number}$"><br>
<anti-action application="set" data="ringback=${us-ring}"/><br> <anti-action application="set" data="transfer_ringback=${us-ring}"/><br> <anti-action application="set" data="call_timeout=10"/><br>
<anti-action application="set" data="hangup_after_bridge=true"/><br> <anti-action application="set" data="continue_on_fail=NORMAL_TEMPORARY_FAILURE,USER_BUSY,NO_ANSWER,TIMEOUT,NO_ROUTE_DESTINATION,USER_NOT_REGISTERED"/><br>
<anti-action application="set" data="continue_on_fail=true"/><br> <anti-action application="db" data="insert/${domain_name}-call_return/${dialed_extension}/${caller_id_number}"/><br>
<anti-action application="db" data="insert/${domain_name}-last_dial_ext/${dialed_extension}/${uuid}"/><br> <anti-action application="set" data="called_party_callgroup=${user_data(${dialed_extension}@${domain_name}var callgroup)}"/><br>
<anti-action application="db" data="insert/${domain_name}-last_dial/${called_party_callgroup}/${uuid}"/><br> <anti-action application="bridge" data="user/${dialed_extension}@${domain_name}"/><br>
<anti-action application="answer"/><br> <anti-action application="export" data="sip_h_X-SPFrom=&quote;${sip_from_user}&quote;&lt;${sip_from_uri}&gt;"/><br> <anti-action application="export" data="sip_h_X-SPTo=&lt;${sip_to_uri}&gt;"/><br>
<anti-action application="export" data="sip_h_X-SPCallId=${sip_call_id}"/><br> <anti-action application="bridge" data="sofia/external/${orgname}send2voicemail@$${starpound_sip_app_server}"/><br>
</condition><br></extension><br><br>Call being answered. Then B wants to hold a call (A should hear music-on-hold, B should hear nothing but still have a call). To accomplish this I:<br>1. on behalf of B2BUA make call to FreeSwitch "hold" extension, get SDP for music-on-hold (moh_sdp)<br>
<extension name="hold"><br> <condition field="destination_number" expression="hold"><br> <action application="answer"/><br> <action application="playback" data="$${hold_music}"/><br>
</condition><br></extension><br>2. re-invite A with SDP moh_sdp<br>3. re-invite B with it's own sdp and attribute 'inactive' (also tried re-invite with A's SDP and 'inactive' and with 0.0.0.0 IP in SDP and 'inactive' - same results)<br>
<br>Result: both A and B hear music-on-hold.<br>I suspect that the reason is in 'bridge' function.. it seems, that it still bridges media against the SIP.<br><br>Here is a snippet from FreeSwitch log related to "strange" (from my point of view) behaviour - when FreeSwitch change media for B to the incorrect one.<br>
Here 1004 is B.<br><br>2009-05-26 13:19:14 [DEBUG] sofia_glue.c:2939 sofia_glue_negotiate_sdp()<br>Audio Codec Compare [GSM:3:8000:20]/[GSM:3:8000:20]<br>2009-05-26 13:19:14 [DEBUG] sofia_glue.c:1863 sofia_glue_tech_set_codec()<br>
Already using GSM<br>2009-05-26 13:19:14 [DEBUG] sofia_glue.c:2899 sofia_glue_negotiate_sdp()<br>Set 2833 dtmf payload to 101<br>2009-05-26 13:19:14 [DEBUG] sofia_glue.c:2908 sofia_glue_negotiate_sdp()<br>Set comfort noise payload to 13<br>
2009-05-26 13:19:14 [DEBUG] sofia_glue.c:2139 sofia_glue_activate_rtp()<br>Audio params changed for sofia/external/<a href="http://6782886802@10.249.194.9:5060">6782886802@10.249.194.9:5060</a> from<br><a href="http://75.101.166.29:27426">75.101.166.29:27426</a> to <a href="http://75.101.166.29:22922">75.101.166.29:22922</a><br>
2009-05-26 13:19:14 [DEBUG] sofia_glue.c:2146 sofia_glue_activate_rtp()<br>AUDIO RTP [sofia/external/<a href="http://6782886802@10.249.194.9:5060">6782886802@10.249.194.9:5060</a>] 10.249.194.9 port<br>28594 -> 75.101.166.29 port 22922 codec: 3 ms: 20<br>
2009-05-26 13:19:14 [DEBUG] sofia_glue.c:2165 sofia_glue_activate_rtp()<br>AUDIO RTP CHANGING DEST TO: [<a href="http://75.101.166.29:22922">75.101.166.29:22922</a>]<br>2009-05-26 13:19:14 [DEBUG] sofia.c:2996 sofia_handle_sip_i_state()<br>
Channel sofia/external/<a href="mailto:1005@10.249.194.9">1005@10.249.194.9</a> entering state [ready][200]<br>2009-05-26 13:19:15 [DEBUG] switch_ivr.c:540 switch_ivr_parse_event()<br>sofia/doublenat5090/<a href="mailto:sip%3A1004@172.16.0.6">sip:1004@172.16.0.6</a>;fs_nat=yes;fs_path=sip%3A1004%40193.33.170.63%3A5060<br>
Command Execute playback(local_stream://moh)<br>EXECUTE sofia/doublenat5090/<a href="mailto:sip%3A1004@172.16.0.6">sip:1004@172.16.0.6</a>;fs_nat=yes;fs_path=sip%3A1004%40193.33.170.63%3A5060 playback(local_stream://moh)<br>
2009-05-26 13:19:15 [DEBUG] mod_local_stream.c:346<br>local_stream_file_open() Opening Stream [moh/8000] 8000hz<br>2009-05-26 13:19:15 [DEBUG] switch_ivr_play_say.c:1084<br>switch_ivr_play_file() Codec Activated L16@8000hz 1 channels 20ms<br>
2009-05-26 13:19:15 [DEBUG] switch_core_io.c:649<br>switch_core_session_write_frame()<br>sofia/doublenat5090/<a href="mailto:sip%3A1004@172.16.0.6">sip:1004@172.16.0.6</a>;fs_nat=yes;fs_path=sip%3A1004%40193.33.170.63%3A5060<br>
receive message [TRANSCODING_NECESSARY]<br><br><br>Any thoughts would be really appreciated!<br>Artem<br><br>