diff options
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_dahdi.c | 28 | ||||
-rw-r--r-- | channels/chan_iax2.c | 2 | ||||
-rw-r--r-- | channels/chan_mgcp.c | 20 | ||||
-rw-r--r-- | channels/chan_skinny.c | 75 | ||||
-rw-r--r-- | channels/sig_analog.c | 25 |
5 files changed, 102 insertions, 48 deletions
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c index d18e94d14..a31c8e7bc 100644 --- a/channels/chan_dahdi.c +++ b/channels/chan_dahdi.c @@ -126,6 +126,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/features_config.h" #include "asterisk/bridge.h" #include "asterisk/stasis_channels.h" +#include "asterisk/parking.h" #include "chan_dahdi.h" #include "dahdi/bridge_native_dahdi.h" @@ -9230,6 +9231,10 @@ static void *analog_ss_thread(void *data) int idx; struct ast_format tmpfmt; RAII_VAR(struct ast_features_pickup_config *, pickup_cfg, NULL, ao2_cleanup); + RAII_VAR(struct ast_parking_bridge_feature_fn_table *, parking_provider, + ast_parking_get_bridge_features(), + ao2_cleanup); + int is_exten_parking; const char *pickupexten; ast_mutex_lock(&ss_thread_lock); @@ -9560,11 +9565,13 @@ static void *analog_ss_thread(void *data) exten[len++]=res; exten[len] = '\0'; } - if (!ast_ignore_pattern(ast_channel_context(chan), exten)) + if (!ast_ignore_pattern(ast_channel_context(chan), exten)) { tone_zone_play_tone(p->subs[idx].dfd, -1); - else + } else { tone_zone_play_tone(p->subs[idx].dfd, DAHDI_TONE_DIALTONE); - if (ast_exists_extension(chan, ast_channel_context(chan), exten, 1, p->cid_num) && !ast_parking_ext_valid(exten, chan, ast_channel_context(chan))) { + } + is_exten_parking = (parking_provider ? parking_provider->parking_is_exten_park(ast_channel_context(chan), exten) : 0); + if (ast_exists_extension(chan, ast_channel_context(chan), exten, 1, p->cid_num) && !is_exten_parking) { if (!res || !ast_matchmore_extension(chan, ast_channel_context(chan), exten, 1, p->cid_num)) { if (getforward) { /* Record this as the forwarding extension */ @@ -9700,14 +9707,17 @@ static void *analog_ss_thread(void *data) getforward = 0; memset(exten, 0, sizeof(exten)); len = 0; - } else if ((p->transfer || p->canpark) && ast_parking_ext_valid(exten, chan, ast_channel_context(chan)) && - p->subs[SUB_THREEWAY].owner && - ast_bridged_channel(p->subs[SUB_THREEWAY].owner)) { + } else if ((p->transfer || p->canpark) && is_exten_parking && + p->subs[SUB_THREEWAY].owner) { + RAII_VAR(struct ast_bridge_channel *, bridge_channel, NULL, ao2_cleanup); /* This is a three way call, the main call being a real channel, and we're parking the first call. */ - ast_masq_park_call_exten(ast_bridged_channel(p->subs[SUB_THREEWAY].owner), - chan, exten, ast_channel_context(chan), 0, NULL); - ast_verb(3, "Parking call to '%s'\n", ast_channel_name(chan)); + ast_channel_lock(chan); + bridge_channel = ast_channel_get_bridge_channel(chan); + ast_channel_unlock(chan); + if (bridge_channel && !parking_provider->parking_blind_transfer_park(bridge_channel, ast_channel_context(chan), exten)) { + ast_verb(3, "Parking call to '%s'\n", ast_channel_name(chan)); + } break; } else if (p->hidecallerid && !strcmp(exten, "*82")) { ast_verb(3, "Enabling Caller*ID on %s\n", ast_channel_name(chan)); diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 26ca36d75..1ae5505e3 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -9202,7 +9202,7 @@ static void dp_lookup(int callno, const char *context, const char *callednum, co memset(&ied1, 0, sizeof(ied1)); mm = ast_matchmore_extension(NULL, context, callednum, 1, callerid); /* Must be started */ - if (ast_parking_ext_valid(callednum, NULL, context) || ast_exists_extension(NULL, context, callednum, 1, callerid)) { + if (ast_exists_extension(NULL, context, callednum, 1, callerid)) { dpstatus = IAX_DPSTATUS_EXISTS; } else if (ast_canmatch_extension(NULL, context, callednum, 1, callerid)) { dpstatus = IAX_DPSTATUS_CANEXIST; diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c index 79208daa0..233d2c3ff 100644 --- a/channels/chan_mgcp.c +++ b/channels/chan_mgcp.c @@ -84,6 +84,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/stasis.h" #include "asterisk/bridge.h" #include "asterisk/features_config.h" +#include "asterisk/parking.h" /* * Define to work around buggy dlink MGCP phone firmware which @@ -2980,6 +2981,9 @@ static void *mgcp_ss(void *data) int getforward = 0; int loop_pause = 100; RAII_VAR(struct ast_features_pickup_config *, pickup_cfg, NULL, ao2_cleanup); + RAII_VAR(struct ast_parking_bridge_feature_fn_table *, parking_provider, + ast_parking_get_bridge_features(), + ao2_cleanup); const char *pickupexten; len = strlen(p->dtmf_buf); @@ -3148,13 +3152,17 @@ static void *mgcp_ss(void *data) getforward = 0; memset(p->dtmf_buf, 0, sizeof(p->dtmf_buf)); len = 0; - } else if (ast_parking_ext_valid(p->dtmf_buf, chan, ast_channel_context(chan)) && - sub->next->owner && ast_bridged_channel(sub->next->owner)) { + } else if (parking_provider && parking_provider->parking_is_exten_park(ast_channel_context(chan), p->dtmf_buf) && + sub->next->owner) { + RAII_VAR(struct ast_bridge_channel *, bridge_channel, NULL, ao2_cleanup); /* This is a three way call, the main call being a real channel, - and we're parking the first call. */ - ast_masq_park_call_exten(ast_bridged_channel(sub->next->owner), chan, - p->dtmf_buf, ast_channel_context(chan), 0, NULL); - ast_verb(3, "Parking call to '%s'\n", ast_channel_name(chan)); + and we're parking the first call. */ + ast_channel_lock(chan); + bridge_channel = ast_channel_get_bridge_channel(chan); + ast_channel_unlock(chan); + if (bridge_channel && !parking_provider->parking_blind_transfer_park(bridge_channel, ast_channel_context(chan), p->dtmf_buf)) { + ast_verb(3, "Parking call to '%s'\n", ast_channel_name(chan)); + } break; } else if (!ast_strlen_zero(p->lastcallerid) && !strcmp(p->dtmf_buf, "*60")) { ast_verb(3, "Blacklisting number %s\n", p->lastcallerid); diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c index c7485470a..c97451577 100644 --- a/channels/chan_skinny.c +++ b/channels/chan_skinny.c @@ -82,6 +82,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/linkedlists.h" #include "asterisk/stasis_endpoints.h" #include "asterisk/bridge.h" +#include "asterisk/parking.h" /*** DOCUMENTATION <manager name="SKINNYdevices" language="en_US"> @@ -6404,24 +6405,37 @@ static int handle_stimulus_message(struct skinny_req *req, struct skinnysession break; case STIMULUS_CALLPARK: { - int extout; + char extout[AST_MAX_EXTENSION]; char message[32]; - + RAII_VAR(struct ast_parking_bridge_feature_fn_table *, parking_provider, + ast_parking_get_bridge_features(), + ao2_cleanup); + RAII_VAR(struct ast_bridge_channel *, bridge_channel, NULL, ao2_cleanup); SKINNY_DEBUG(DEBUG_PACKET, 3, "Received STIMULUS_CALLPARK from %s, inst %d, callref %d\n", d->name, instance, callreference); - if ((sub && sub->owner) && (ast_channel_state(sub->owner) == AST_STATE_UP)){ + if (!parking_provider) { + transmit_displaynotify(d, "Call Park not available", 10); + break; + } + + if ((sub && sub->owner) && (ast_channel_state(sub->owner) == AST_STATE_UP)) { c = sub->owner; - if (ast_bridged_channel(c)) { - if (!ast_masq_park_call(ast_bridged_channel(c), c, 0, &extout)) { - snprintf(message, sizeof(message), "Call Parked at: %d", extout); - transmit_displaynotify(d, message, 10); - } else { - transmit_displaynotify(d, "Call Park failed", 10); - } - } else { - transmit_displaynotify(d, "Call Park not available", 10); + ast_channel_lock(c); + bridge_channel = ast_channel_get_bridge_channel(c); + ast_channel_unlock(c); + + if (!bridge_channel) { + transmit_displaynotify(d, "Call Park failed", 10); + break; + } + + if (!parking_provider->parking_park_call(bridge_channel, extout, sizeof(extout))) { + snprintf(message, sizeof(message), "Call Parked at: %s", extout); + transmit_displaynotify(d, message, 10); + break; } + transmit_displaynotify(d, "Call Park failed", 10); } else { transmit_displaynotify(d, "Call Park not available", 10); } @@ -7141,24 +7155,37 @@ static int handle_soft_key_event_message(struct skinny_req *req, struct skinnyse break; case SOFTKEY_PARK: { - int extout; + char extout[AST_MAX_EXTENSION]; char message[32]; - + RAII_VAR(struct ast_parking_bridge_feature_fn_table *, parking_provider, + ast_parking_get_bridge_features(), + ao2_cleanup); + RAII_VAR(struct ast_bridge_channel *, bridge_channel, NULL, ao2_cleanup); SKINNY_DEBUG(DEBUG_PACKET, 3, "Received SOFTKEY_PARK from %s, inst %d, callref %d\n", d->name, instance, callreference); - if ((sub && sub->owner) && (ast_channel_state(sub->owner) == AST_STATE_UP)){ + if (!parking_provider) { + transmit_displaynotify(d, "Call Park not available", 10); + break; + } + + if ((sub && sub->owner) && (ast_channel_state(sub->owner) == AST_STATE_UP)) { c = sub->owner; - if (ast_bridged_channel(c)) { - if (!ast_masq_park_call(ast_bridged_channel(c), c, 0, &extout)) { - snprintf(message, sizeof(message), "Call Parked at: %d", extout); - transmit_displaynotify(d, message, 10); - } else { - transmit_displaynotify(d, "Call Park failed", 10); - } - } else { - transmit_displaynotify(d, "Call Park not available", 10); + ast_channel_lock(c); + bridge_channel = ast_channel_get_bridge_channel(c); + ast_channel_unlock(c); + + if (!bridge_channel) { + transmit_displaynotify(d, "Call Park failed", 10); + break; + } + + if (!parking_provider->parking_park_call(bridge_channel, extout, sizeof(extout))) { + snprintf(message, sizeof(message), "Call Parked at: %s", extout); + transmit_displaynotify(d, message, 10); + break; } + transmit_displaynotify(d, "Call Park failed", 10); } else { transmit_displaynotify(d, "Call Park not available", 10); } diff --git a/channels/sig_analog.c b/channels/sig_analog.c index 9effae1f1..4b5ae8887 100644 --- a/channels/sig_analog.c +++ b/channels/sig_analog.c @@ -44,6 +44,7 @@ #include "asterisk/causes.h" #include "asterisk/features_config.h" #include "asterisk/bridge.h" +#include "asterisk/parking.h" #include "sig_analog.h" @@ -1713,7 +1714,11 @@ static void *__analog_ss_thread(void *data) int idx; struct ast_callid *callid; RAII_VAR(struct ast_features_pickup_config *, pickup_cfg, NULL, ao2_cleanup); + RAII_VAR(struct ast_parking_bridge_feature_fn_table *, parking_provider, + ast_parking_get_bridge_features(), + ao2_cleanup); const char *pickupexten; + int is_exten_parking; analog_increase_ss_count(); @@ -2094,7 +2099,8 @@ static void *__analog_ss_thread(void *data) } else { analog_play_tone(p, idx, ANALOG_TONE_DIALTONE); } - if (ast_exists_extension(chan, ast_channel_context(chan), exten, 1, p->cid_num) && !ast_parking_ext_valid(exten, chan, ast_channel_context(chan))) { + is_exten_parking = (parking_provider ? parking_provider->parking_is_exten_park(ast_channel_context(chan), exten) : 0); + if (ast_exists_extension(chan, ast_channel_context(chan), exten, 1, p->cid_num) && !is_exten_parking) { if (!res || !ast_matchmore_extension(chan, ast_channel_context(chan), exten, 1, p->cid_num)) { if (getforward) { /* Record this as the forwarding extension */ @@ -2238,15 +2244,18 @@ static void *__analog_ss_thread(void *data) getforward = 0; memset(exten, 0, sizeof(exten)); len = 0; - } else if ((p->transfer || p->canpark) && ast_parking_ext_valid(exten, chan, ast_channel_context(chan)) && - p->subs[ANALOG_SUB_THREEWAY].owner && - ast_bridged_channel(p->subs[ANALOG_SUB_THREEWAY].owner)) { + } else if ((p->transfer || p->canpark) && is_exten_parking && + p->subs[ANALOG_SUB_THREEWAY].owner) { + struct ast_bridge_channel *bridge_channel; /* This is a three way call, the main call being a real channel, and we're parking the first call. */ - ast_masq_park_call_exten( - ast_bridged_channel(p->subs[ANALOG_SUB_THREEWAY].owner), chan, exten, - ast_channel_context(chan), 0, NULL); - ast_verb(3, "Parking call to '%s'\n", ast_channel_name(chan)); + ast_channel_lock(chan); + bridge_channel = ast_channel_get_bridge_channel(chan); + ast_channel_unlock(chan); + if (bridge_channel && !parking_provider->parking_blind_transfer_park(bridge_channel, ast_channel_context(chan), exten)) { + ast_verb(3, "Parking call to '%s'\n", ast_channel_name(chan)); + } + ao2_ref(bridge_channel, -1); break; } else if (!ast_strlen_zero(p->lastcid_num) && !strcmp(exten, "*60")) { ast_verb(3, "Blacklisting number %s\n", p->lastcid_num); |