#endif
res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_CONGESTION);
break;
+#ifdef ZAPATA_PRI
+ case AST_CONTROL_HOLD:
+ res = pri_notify(p->pri->pri, p->call, p->prioffset, PRI_NOTIFY_REMOTE_HOLD);
+ break;
+ case AST_CONTROL_UNHOLD:
+ res = pri_notify(p->pri->pri, p->call, p->prioffset, PRI_NOTIFY_REMOTE_RETRIEVAL);
+ break;
+#endif
case AST_CONTROL_RADIO_KEY:
if (p->radio)
res = zt_set_hook(p->subs[index].zfd, ZT_OFFHOOK);
ast_mutex_unlock(&pri->pvts[chanpos]->lock);
}
break;
+ case PRI_EVENT_NOTIFY:
+ chanpos = pri_find_principle(pri, e->notify.channel);
+ if (chanpos < 0) {
+ ast_log(LOG_WARNING, "Received NOTIFY on unconfigured channel %d/%d span %d\n",
+ PRI_SPAN(e->notify.channel), PRI_CHANNEL(e->notify.channel), pri->span);
+ } else {
+ struct ast_frame f = { AST_FRAME_CONTROL, };
+ ast_mutex_lock(&pri->pvts[chanpos]->lock);
+ switch(e->notify.info) {
+ case PRI_NOTIFY_REMOTE_HOLD:
+ f.subclass = AST_CONTROL_HOLD;
+ zap_queue_frame(pri->pvts[chanpos], &f, pri);
+ break;
+ case PRI_NOTIFY_REMOTE_RETRIEVAL:
+ f.subclass = AST_CONTROL_UNHOLD;
+ zap_queue_frame(pri->pvts[chanpos], &f, pri);
+ break;
+ }
+ ast_mutex_unlock(&pri->pvts[chanpos]->lock);
+ }
+ break;
default:
ast_log(LOG_DEBUG, "Event: %d\n", e->e);
}
pu->chan = chan;
/* Start music on hold */
- if (chan != peer)
+ if (chan != peer) {
+ ast_indicate(pu->chan, AST_CONTROL_HOLD);
ast_moh_start(pu->chan, NULL);
+ }
gettimeofday(&pu->start, NULL);
pu->parkingnum = x;
if (timeout > 0)
}
/* Start autoservice on chan while we talk
to the originator */
+ ast_indicate(transferee, AST_CONTROL_HOLD);
ast_autoservice_start(transferee);
ast_moh_start(transferee, NULL);
if ((res=ast_streamfile(transferer, "pbx-transfer", transferer->language))) {
ast_moh_stop(transferee);
ast_autoservice_stop(transferee);
+ ast_indicate(transferee, AST_CONTROL_UNHOLD);
return res;
}
if ((res=ast_waitstream(transferer, AST_DIGIT_ANY)) < 0) {
ast_moh_stop(transferee);
ast_autoservice_stop(transferee);
+ ast_indicate(transferee, AST_CONTROL_UNHOLD);
return res;
}
ast_stopstream(transferer);
if (res < 0) {
ast_moh_stop(transferee);
ast_autoservice_stop(transferee);
+ ast_indicate(transferee, AST_CONTROL_UNHOLD);
return res;
}
if (!strcmp(newext, ast_parking_ext())) {
ast_moh_stop(transferee);
- if (ast_autoservice_stop(transferee))
+ res = ast_autoservice_stop(transferee);
+ ast_indicate(transferee, AST_CONTROL_UNHOLD);
+ if (res)
res = -1;
else if (!ast_park_call(transferee, transferer, 0, NULL)) {
/* We return non-zero, but tell the PBX not to hang the channel when
pbx_builtin_setvar_helper(chan, "BLINDTRANSFER", peer->name);
ast_moh_stop(transferee);
res=ast_autoservice_stop(transferee);
+ ast_indicate(transferee, AST_CONTROL_UNHOLD);
if (!transferee->pbx) {
/* Doh! Use our handy async_goto functions */
if (option_verbose > 2)
if (res) {
ast_moh_stop(transferee);
ast_autoservice_stop(transferee);
+ ast_indicate(transferee, AST_CONTROL_UNHOLD);
return res;
}
res = ast_waitstream(transferer, AST_DIGIT_ANY);
ast_stopstream(transferer);
ast_moh_stop(transferee);
res = ast_autoservice_stop(transferee);
+ ast_indicate(transferee, AST_CONTROL_UNHOLD);
if (res) {
if (option_verbose > 1)
ast_verbose(VERBOSE_PREFIX_2 "Hungup during autoservice stop on '%s'\n", transferee->name);
}
/* Start autoservice on chan while we talk
to the originator */
+ ast_indicate(transferee, AST_CONTROL_HOLD);
ast_autoservice_start(transferee);
ast_moh_start(transferee, NULL);
if ((res=ast_streamfile(transferer, "pbx-transfer", transferer->language))) {
ast_moh_stop(transferee);
ast_autoservice_stop(transferee);
+ ast_indicate(transferee, AST_CONTROL_UNHOLD);
return res;
}
if ((res=ast_waitstream(transferer, AST_DIGIT_ANY)) < 0) {
ast_moh_stop(transferee);
ast_autoservice_stop(transferee);
+ ast_indicate(transferee, AST_CONTROL_UNHOLD);
return res;
}
if ((ast_app_dtget(transferer, transferer_real_context, xferto, sizeof(xferto), 100, transferdigittimeout))) {
}
ast_moh_stop(transferee);
ast_autoservice_stop(transferee);
+ ast_indicate(transferee, AST_CONTROL_UNHOLD);
transferer->_softhangup = 0;
return FEATURE_RETURN_SUCCESS;
}
ast_log(LOG_WARNING, "Unable to create channel Local/%s do you have chan_local?\n",dialstr);
ast_moh_stop(transferee);
ast_autoservice_stop(transferee);
+ ast_indicate(transferee, AST_CONTROL_UNHOLD);
if (!ast_strlen_zero(xferfailsound)) {
res = ast_streamfile(transferer, xferfailsound, transferer->language);
if (!res && (ast_waitstream(transferer, "") < 0)) {
ast_log(LOG_WARNING, "Extension %s does not exist in context %s\n",xferto,transferer_real_context);
ast_moh_stop(transferee);
ast_autoservice_stop(transferee);
+ ast_indicate(transferee, AST_CONTROL_UNHOLD);
res = ast_streamfile(transferer, "beeperr", transferer->language);
if (!res && (ast_waitstream(transferer, "") < 0)) {
return -1;
}
ast_moh_stop(transferee);
ast_autoservice_stop(transferee);
-
+ ast_indicate(transferee, AST_CONTROL_UNHOLD);
return FEATURE_RETURN_SUCCESS;
}
if (tms > pu->parkingtime) {
/* Stop music on hold */
ast_moh_stop(pu->chan);
+ ast_indicate(pu->chan, AST_CONTROL_UNHOLD);
/* Get chan, exten from derived kludge */
if (pu->peername[0]) {
peername = ast_strdupa(pu->peername);
}
ast_moh_stop(peer);
+ ast_indicate(peer, AST_CONTROL_UNHOLD);
res = ast_channel_make_compatible(chan, peer);
if (res < 0) {
ast_log(LOG_WARNING, "Could not make channels %s and %s compatible for bridge\n", chan->name, peer->name);