bchannel_pipeline(call->bchannel, call->pipeline);
break;
case 'r':
- if (opt[1] == '\0') {
+ if (opt[1] != '\0') {
CERROR(call, call->ast, "Option 'r' (re-buffer 160 bytes) expects no parameter.\n", opt);
break;
}
int open_socket(void)
{
int ret;
- char *socket_name = SOCKET_NAME;
int conn;
struct sockaddr_un sock_address;
unsigned int on = 1;
/* set socket address and name */
memset(&sock_address, 0, sizeof(sock_address));
sock_address.sun_family = PF_UNIX;
- strcpy(sock_address.sun_path, socket_name);
+ sprintf(sock_address.sun_path, SOCKET_NAME, options.lock);
/* connect socket */
if ((conn = connect(lcr_sock, (struct sockaddr *)&sock_address, SUN_LEN(&sock_address))) < 0)
/*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");
/*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;
/*
* fixup asterisk
*/
-static int lcr_fixup(struct ast_channel *oldast, struct ast_channel *newast)
+static int lcr_fixup(struct ast_channel *oldast, struct ast_channel *ast)
{
struct chan_call *call;
+ if (!ast) {
+ return -1;
+ }
+
ast_mutex_lock(&chan_lock);
- call = oldast->tech_pvt;
+ call = ast->tech_pvt;
if (!call) {
- CERROR(NULL, oldast, "Received fixup from Asterisk, but no call instance exists.\n");
+ CERROR(NULL, ast, "Received fixup from Asterisk, but no call instance exists.\n");
ast_mutex_unlock(&chan_lock);
return -1;
}
- CDEBUG(call, oldast, "Received fixup from Asterisk.\n");
- call->ast = newast;
- ast_mutex_lock(&chan_lock);
+ CDEBUG(call, ast, "Received fixup from Asterisk.\n");
+ call->ast = ast;
+ ast_mutex_unlock(&chan_lock);
return 0;
}
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);