summaryrefslogtreecommitdiffstats
path: root/chan_lcr.c
diff options
context:
space:
mode:
authorPeter Schlaile2008-09-22 20:35:37 +0200
committerroot2008-09-22 20:35:37 +0200
commit3acba5ac9bfdd677ac6c6e6bfaff779dedfc9483 (patch)
tree141b1062e5ce4c62db1841408b4ff09a83b2a8d7 /chan_lcr.c
parentfixed some layer 2 link issues (diff)
downloadlcr-3acba5ac9bfdd677ac6c6e6bfaff779dedfc9483.tar.gz
lcr-3acba5ac9bfdd677ac6c6e6bfaff779dedfc9483.tar.xz
lcr-3acba5ac9bfdd677ac6c6e6bfaff779dedfc9483.zip
work around broken HOLD/UNHOLD handling on some SIP phones
Some SIP phones don't send RETRIEVE before they send TRANSFER. So we RETRIEVE if we bridge two channels, if calls are still on hold. Also: handle CONTROL_SRCUPDATE with a debug message in recent versions of asterisk.
Diffstat (limited to 'chan_lcr.c')
-rw-r--r--chan_lcr.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/chan_lcr.c b/chan_lcr.c
index 52c2a31..b28965a 100644
--- a/chan_lcr.c
+++ b/chan_lcr.c
@@ -2069,6 +2069,7 @@ static int lcr_indicate(struct ast_channel *ast, int cond, const void *data, siz
/*start music onhold*/
ast_moh_start(ast,data,ast->musicclass);
+ call->on_hold = 1;
break;
case AST_CONTROL_UNHOLD:
CDEBUG(call, ast, "Received indicate AST_CONTROL_UNHOLD from Asterisk.\n");
@@ -2079,8 +2080,14 @@ static int lcr_indicate(struct ast_channel *ast, int cond, const void *data, siz
/*stop moh*/
ast_moh_stop(ast);
+ call->on_hold = 0;
break;
-
+#ifdef AST_CONTROL_SRCUPDATE
+ case AST_CONTROL_SRCUPDATE:
+ CDEBUG(call, ast, "Received indicate AST_CONTROL_SRCUPDATE from Asterisk.\n");
+ res = -1;
+ break;
+#endif
default:
CERROR(call, ast, "Received indicate from Asterisk with unknown condition %d.\n", cond);
res = -1;
@@ -2207,6 +2214,30 @@ enum ast_bridge_result lcr_bridge(struct ast_channel *ast1,
CDEBUG(call2, ast2, "Bridge established before lcr_answer, so we call it ourself: Calling lcr_answer...\n");
lcr_answer(ast2);
}
+
+ /* sometimes SIP phones forget to send RETRIEVE before TRANSFER
+ so let's do it for them. Hmpf.
+ */
+
+ if (call1->on_hold) {
+ union parameter newparam;
+
+ memset(&newparam, 0, sizeof(union parameter));
+ newparam.notifyinfo.notify = INFO_NOTIFY_REMOTE_RETRIEVAL;
+ send_message(MESSAGE_NOTIFY, call1->ref, &newparam);
+
+ call1->on_hold = 0;
+ }
+
+ if (call2->on_hold) {
+ union parameter newparam;
+
+ memset(&newparam, 0, sizeof(union parameter));
+ newparam.notifyinfo.notify = INFO_NOTIFY_REMOTE_RETRIEVAL;
+ send_message(MESSAGE_NOTIFY, call2->ref, &newparam);
+
+ call2->on_hold = 0;
+ }
ast_mutex_unlock(&chan_lock);