]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add temp_hold_music var that is only valid until you transfer the call and finishing...
authorAnthony Minessale <anthm@freeswitch.org>
Thu, 6 Jan 2011 00:58:56 +0000 (18:58 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Thu, 6 Jan 2011 00:58:56 +0000 (18:58 -0600)
src/mod/applications/mod_dptools/mod_dptools.c
src/mod/applications/mod_fifo/mod_fifo.c
src/mod/applications/mod_spy/mod_spy.c
src/mod/applications/mod_valet_parking/mod_valet_parking.c
src/mod/endpoints/mod_khomp/src/khomp_pvt_kxe1.cpp
src/mod/endpoints/mod_sofia/sofia.c
src/mod/endpoints/mod_sofia/sofia_glue.c
src/switch_channel.c
src/switch_ivr.c
src/switch_ivr_async.c
src/switch_ivr_play_say.c

index 7388094568768de7834ae2da293ab65301b78070..4602dd2bc544fd745902fddcc8941f119996ab51 100755 (executable)
@@ -2531,7 +2531,7 @@ SWITCH_STANDARD_APP(audio_bridge_function)
                        camp_data = (char *) data;
                }
 
-               if (!(moh = switch_channel_get_variable(caller_channel, SWITCH_HOLD_MUSIC_VARIABLE))) {
+               if (!(moh = switch_channel_get_hold_music(caller_channel))) {
                        moh = switch_channel_get_variable(caller_channel, "campon_hold_music");
                }
 
index 1f9d9d6a576025f5ba16a6e0b1db13a8d2a85f09..2e074138ba0723e1b5826e85a3f4c8e5d2711c0c 100644 (file)
@@ -397,12 +397,12 @@ static switch_status_t on_dtmf(switch_core_session_t *session, void *input, swit
                                        const char *moh_a = NULL, *moh_b = NULL;
 
                                        if (!(moh_b = switch_channel_get_variable(bchan, "fifo_music"))) {
-                                               moh_b = switch_channel_get_variable(bchan, SWITCH_HOLD_MUSIC_VARIABLE);
+                                               moh_b = switch_channel_get_hold_music(bchan);
                                        }
 
                                        if (!(moh_a = switch_channel_get_variable(channel, "fifo_hold_music"))) {
                                                if (!(moh_a = switch_channel_get_variable(channel, "fifo_music"))) {
-                                                       moh_a = switch_channel_get_variable(channel, SWITCH_HOLD_MUSIC_VARIABLE);
+                                                       moh_a = switch_channel_get_hold_music(channel);
                                                }
                                        }
 
index 411ed090a3dc6b2d9c02e8f60029008d492d9e67..9986703f66e961a03e31682be44c760045441a72 100644 (file)
@@ -83,7 +83,7 @@ static switch_status_t spy_on_exchange_media(switch_core_session_t *session)
 static switch_status_t spy_on_park(switch_core_session_t *session)
 {
        switch_channel_t *channel = switch_core_session_get_channel(session);
-       const char *moh = switch_channel_get_variable(channel, SWITCH_HOLD_MUSIC_VARIABLE);
+       const char *moh = switch_channel_get_hold_music(channel);
 
        while (switch_channel_ready(channel) && switch_channel_get_state(channel) == CS_PARK) {
                if (moh) {
index 369ae972e70881afbc833664dcc897535bff4264..42ece97e28bf5a52a0f78a8ab804d017ea378876 100644 (file)
@@ -234,7 +234,7 @@ SWITCH_STANDARD_APP(valet_parking_function)
                }
 
                if (!(tmp = switch_channel_get_variable(channel, "valet_hold_music"))) {
-                       tmp = switch_channel_get_variable(channel, SWITCH_HOLD_MUSIC_VARIABLE);
+                       tmp = switch_channel_get_hold_music(channel);
                }
                if (tmp)
                        music = tmp;
index 0d3c3b38ff1f0ce1befe1612ee340738cb6de917..997973b1df607a13ce66d163d0a18cba6177cb76 100644 (file)
@@ -2744,7 +2744,7 @@ bool BoardE1::KhompPvtFXS::transfer(std::string & context, bool blind)
                 callFXS()->_uuid_other_session = getUUID(peer_session);    
                 const char *stream = NULL;
 
-                if (!(stream = switch_channel_get_variable(peer_channel, SWITCH_HOLD_MUSIC_VARIABLE)))
+                if (!(stream = switch_channel_get_hold_music(peer_channel)))
                 {
                     stream = "silence";
                 }
index 99c18cbaaa95b045dc1e8db838299aa1663d5b45..2643ceb17f81d35cb935e2f777e30f12c789812c 100644 (file)
@@ -5560,7 +5560,7 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t
                                                                switch_core_event_hook_add_state_change(a_session, xfer_hanguphook);
                                                                switch_channel_set_variable(a_channel, "att_xfer_kill_uuid", switch_core_session_get_uuid(b_session));
 
-                                                               if ((tmp = switch_channel_get_variable(a_channel, SWITCH_HOLD_MUSIC_VARIABLE))) {
+                                                               if ((tmp = switch_channel_get_hold_music(a_channel))) {
                                                                        moh = tmp;
                                                                }
 
index 6b8521b10e57b977dab5184d817436f62f68dbce..715b70f59dd58b146166856d2dbef0fc21c4f4a1 100644 (file)
@@ -3663,7 +3663,7 @@ void sofia_glue_toggle_hold(private_object_t *tech_pvt, int sendonly)
                                switch_rtp_set_max_missed_packets(tech_pvt->rtp_session, tech_pvt->max_missed_hold_packets);
                        }
 
-                       if (!(stream = switch_channel_get_variable(tech_pvt->channel, SWITCH_HOLD_MUSIC_VARIABLE))) {
+                       if (!(stream = switch_channel_get_hold_music(tech_pvt->channel))) {
                                stream = tech_pvt->profile->hold_music;
                        }
 
index f592158254298c6aef0286a31e6fa93c899e0a43..918ad82a99de74be7ee0274d2861fb7efa2b9f4e 100644 (file)
@@ -648,9 +648,9 @@ SWITCH_DECLARE(void) switch_channel_mark_hold(switch_channel_t *channel, switch_
 
 SWITCH_DECLARE(const char *) switch_channel_get_hold_music(switch_channel_t *channel)
 {
-       const char *var = switch_channel_get_variable(channel, SWITCH_TEMP_HOLD_MUSIC_VARIABLE);
+       const char *var;
 
-       if (!var) {
+       if (!(var = switch_channel_get_variable(channel, SWITCH_TEMP_HOLD_MUSIC_VARIABLE))) {
                var = switch_channel_get_variable(channel, SWITCH_HOLD_MUSIC_VARIABLE);
        }
 
index 5019e06b4fca333f3e44c98dd4a1b77f1d545a11..496c29b5243514d8887fa39d9fa10e4c27a756b0 100644 (file)
@@ -540,8 +540,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_event(switch_core_session_t *se
                                        const char *stream;
                                        b_uuid = switch_core_session_strdup(session, b_uuid);
 
-                                       if (!(stream = switch_channel_get_variable_partner(channel, SWITCH_HOLD_MUSIC_VARIABLE))) {
-                                               stream = switch_channel_get_variable(channel, SWITCH_HOLD_MUSIC_VARIABLE);
+                                       if (!(stream = switch_channel_get_hold_music_partner(channel))) {
+                                               stream = switch_channel_get_hold_music(channel);
                                        }
 
                                        if (stream && switch_is_moh(stream)) {
@@ -1269,7 +1269,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_hold(switch_core_session_t *session,
 
        switch_core_session_receive_message(session, &msg);
 
-       if (moh && (stream = switch_channel_get_variable(channel, SWITCH_HOLD_MUSIC_VARIABLE))) {
+       if (moh && (stream = switch_channel_get_hold_music(channel))) {
                if ((other_uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
                        switch_ivr_broadcast(other_uuid, stream, SMF_ECHO_ALEG | SMF_LOOP);
                }
@@ -1514,6 +1514,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_
        /* clear all state handlers */
        switch_channel_clear_state_handler(channel, NULL);
 
+       /* reset temp hold music */
+       switch_channel_set_variable(channel, SWITCH_TEMP_HOLD_MUSIC_VARIABLE, NULL);
+
        if ((profile = switch_channel_get_caller_profile(channel))) {
                const char *var;
 
index e987a4671a0227ab523d888ea3f0e310a0aa1fcf..1483e887dec18e570fe7bd4b08c0c51acd93d2b1 100644 (file)
@@ -2825,11 +2825,11 @@ static switch_status_t meta_on_dtmf(switch_core_session_t *session, const switch
        }
 
        if (md->sr[direction].meta_on) {
-               if (dtmf->digit >= '0' && dtmf->digit <= '9') {
+               if (is_dtmf(dtmf->digit)) {
                        int ok = 0;
                        *digit = dtmf->digit;
-                       dval = atoi(digit);
-
+                       dval = switch_dtmftoi(digit);
+                       
                        if (direction == SWITCH_DTMF_RECV && (md->sr[direction].map[dval].bind_flags & SBF_DIAL_ALEG)) {
                                ok = 1;
                        } else if (direction == SWITCH_DTMF_SEND && (md->sr[direction].map[dval].bind_flags & SBF_DIAL_BLEG)) {
index 7e5f71edc7231cee881345ac0a185115355676b1..523dfdeb028d5c5dbc0f7129c0feff22bdaed4b8 100644 (file)
@@ -2394,7 +2394,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_soft_hold(switch_core_session_t *sess
                        if (moh_b) {
                                moh = moh_b;
                        } else {
-                               moh = switch_channel_get_variable(other_channel, SWITCH_HOLD_MUSIC_VARIABLE);
+                               moh = switch_channel_get_hold_music(other_channel);
                        }
 
                        if (!zstr(moh) && strcasecmp(moh, "silence") && !switch_channel_test_flag(other_channel, CF_BROADCAST)) {
@@ -2405,7 +2405,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_soft_hold(switch_core_session_t *sess
                        if (moh_a) {
                                moh = moh_a;
                        } else {
-                               moh = switch_channel_get_variable(channel, SWITCH_HOLD_MUSIC_VARIABLE);
+                               moh = switch_channel_get_hold_music(channel);
                        }
 
                        if (!zstr(moh) && strcasecmp(moh, "silence")) {