va_end(args);
if (call)
- sprintf(call_text, "%ld", call->ref);
+ sprintf(call_text, "%d", call->ref);
if (ast)
strncpy(ast_text, ast->name, sizeof(ast_text)-1);
ast_text[sizeof(ast_text)-1] = '\0';
*/
struct chan_call *call_first;
-struct chan_call *find_call_ref(unsigned long ref)
+struct chan_call *find_call_ref(unsigned int ref)
{
struct chan_call *call = call_first;
return(call);
}
-struct chan_call *find_call_handle(unsigned long handle)
+struct chan_call *find_call_handle(unsigned int handle)
{
struct chan_call *call = call_first;
/*
* enque message to LCR
*/
-int send_message(int message_type, unsigned long ref, union parameter *param)
+int send_message(int message_type, unsigned int ref, union parameter *param)
{
struct admin_list *admin, **adminp;
if (!call->ast || !call->ref)
return;
- CDEBUG(call, call->ast, "Sending setup to LCR. (interface=%s dialstring=%s)\n", call->interface, call->dialstring);
+ CDEBUG(call, call->ast, "Sending setup to LCR. (interface=%s dialstring=%s, cid=%s)\n", call->interface, call->dialstring, call->cid_num);
/* send setup message to LCR */
memset(&newparam, 0, sizeof(union parameter));
newparam.setup.callerinfo.ntype = INFO_NTYPE_UNKNOWN;
strncpy(newparam.setup.callerinfo.display, call->display, sizeof(newparam.setup.callerinfo.display)-1);
call->display[0] = '\0';
- if (ast->cid.cid_num) if (ast->cid.cid_num[0])
- strncpy(newparam.setup.callerinfo.id, ast->cid.cid_num, sizeof(newparam.setup.callerinfo.id)-1);
- if (ast->cid.cid_name) if (ast->cid.cid_name[0])
- strncpy(newparam.setup.callerinfo.name, ast->cid.cid_name, sizeof(newparam.setup.callerinfo.name)-1);
- if (ast->cid.cid_rdnis) if (ast->cid.cid_rdnis[0])
+ if (call->cid_num[0])
+ strncpy(newparam.setup.callerinfo.id, call->cid_num, sizeof(newparam.setup.callerinfo.id)-1);
+ if (call->cid_name[0])
+ strncpy(newparam.setup.callerinfo.name, call->cid_name, sizeof(newparam.setup.callerinfo.name)-1);
+ if (call->cid_rdnis[0])
{
- strncpy(newparam.setup.redirinfo.id, ast->cid.cid_rdnis, sizeof(newparam.setup.redirinfo.id)-1);
+ strncpy(newparam.setup.redirinfo.id, call->cid_rdnis, sizeof(newparam.setup.redirinfo.id)-1);
newparam.setup.redirinfo.itype = INFO_ITYPE_CHAN;
newparam.setup.redirinfo.ntype = INFO_NTYPE_UNKNOWN;
}
if (!call->pbx_started)
{
CDEBUG(call, call->ast, "Asterisk not started, adding digits to number.\n");
- strncat(ast->exten, param->information.id, AST_MAX_EXTENSION-1);
+ strncpy(ast->exten, param->information.id, AST_MAX_EXTENSION-1);
lcr_start_pbx(call, ast, param->information.sending_complete);
return;
}
}
/*
- * got dtmf from bchannel
+ * got dtmf from bchannel (locked state)
*/
void lcr_in_dtmf(struct chan_call *call, int val)
{
if (!call->pbx_started)
return;
- CDEBUG(call, call->ast, "Frowarding DTMF digit '%c' to Asterisk.\n", val);
+ CDEBUG(call, call->ast, "Forwarding DTMF digit '%c' to Asterisk.\n", val);
/* send digit to asterisk */
memset(&fr, 0, sizeof(fr));
/*
* message received from LCR
*/
-int receive_message(int message_type, unsigned long ref, union parameter *param)
+int receive_message(int message_type, unsigned int ref, union parameter *param)
{
struct bchannel *bchannel;
struct chan_call *call;
char *socket_name = SOCKET_NAME;
int conn;
struct sockaddr_un sock_address;
- unsigned long on = 1;
+ unsigned int on = 1;
union parameter param;
/* open socket */
strncpy(call->dialstring, dial, sizeof(call->dialstring)-1);
apply_opt(call, (char *)opt);
- /* if hdlc is forced by option, we change transcap to data */
- if (call->hdlc
- && ast->transfercapability != INFO_BC_DATAUNRESTRICTED
- && ast->transfercapability != INFO_BC_DATARESTRICTED
- && ast->transfercapability != INFO_BC_VIDEO)
- ast->transfercapability = INFO_BC_DATAUNRESTRICTED;
-
ast_mutex_unlock(&chan_lock);
return ast;
}
|| ast->transfercapability == INFO_BC_DATARESTRICTED
|| ast->transfercapability == INFO_BC_VIDEO)
call->hdlc = 1;
-
+ /* if hdlc is forced by option, we change transcap to data */
+ if (call->hdlc
+ && ast->transfercapability != INFO_BC_DATAUNRESTRICTED
+ && ast->transfercapability != INFO_BC_DATARESTRICTED
+ && ast->transfercapability != INFO_BC_VIDEO)
+ ast->transfercapability = INFO_BC_DATAUNRESTRICTED;
+
+ call->cid_num[0] = 0;
+ call->cid_name[0] = 0;
+ call->cid_rdnis[0] = 0;
+
+ if (ast->cid.cid_num) if (ast->cid.cid_num[0])
+ strncpy(call->cid_num, ast->cid.cid_num,
+ sizeof(call->cid_num)-1);
+
+ if (ast->cid.cid_name) if (ast->cid.cid_name[0])
+ strncpy(call->cid_name, ast->cid.cid_name,
+ sizeof(call->cid_name)-1);
+ if (ast->cid.cid_rdnis) if (ast->cid.cid_rdnis[0])
+ strncpy(call->cid_rdnis, ast->cid.cid_rdnis,
+ sizeof(call->cid_rdnis)-1);
+
ast_mutex_unlock(&chan_lock);
return 0;
}