diff --git a/chan_capi.c b/chan_capi.c index cf4a7ae..0c26c88 100644 --- a/chan_capi.c +++ b/chan_capi.c @@ -819,11 +819,9 @@ static int pbx_capi_alert(struct ast_channel *c) i->vname, i->state); return -1; } - - if (i->qsigfeat) { - facilityarray = alloca(CAPI_MAX_FACILITYDATAARRAY_SIZE); - cc_qsig_add_call_alert_data(facilityarray, i, c); - } + + facilityarray = alloca(CAPI_MAX_FACILITYDATAARRAY_SIZE); + cc_qsig_add_call_alert_data(facilityarray, i, c); if (capi_sendf(NULL, 0, CAPI_ALERT_REQ, i->PLCI, get_capi_MessageNumber(), "(()()()s())", facilityarray) != 0) { @@ -1377,10 +1375,8 @@ static int capi_send_answer(struct ast_channel *c, _cstruct b3conf) cc_verbose(3, 0, VERBOSE_PREFIX_2 "%s: Answering for %s\n", i->vname, dnid); - if (i->qsigfeat) { - facilityarray = alloca(CAPI_MAX_FACILITYDATAARRAY_SIZE); - cc_qsig_add_call_answer_data(facilityarray, i, c); - } + facilityarray = alloca(CAPI_MAX_FACILITYDATAARRAY_SIZE); + cc_qsig_add_call_answer_data(facilityarray, i, c); if (capi_sendf(NULL, 0, CAPI_CONNECT_RESP, i->PLCI, i->MessageNumber, "w(wwwssss)s()()(()()()s())", diff --git a/chan_capi_qsig_core.c b/chan_capi_qsig_core.c index 100a7f4..841a009 100644 --- a/chan_capi_qsig_core.c +++ b/chan_capi_qsig_core.c @@ -961,10 +961,14 @@ unsigned int cc_qsig_add_call_answer_data(unsigned char *data, struct capi_pvt * int protocolvar = 0; const char *connectedname; + data[0] = 0; + if (!i->qsigfeat) return 0; - connectedname = pbx_builtin_getvar_helper(c, "CONNECTEDNAME"); + if (!(connectedname = pbx_builtin_getvar_helper(c, "CONNECTEDNAME"))) + return 0; + if (!strlen(connectedname)) return 0; @@ -989,7 +993,7 @@ unsigned int cc_qsig_add_call_answer_data(unsigned char *data, struct capi_pvt * } /* - * Handles outgoing Facilies on Call Answer + * Handles outgoing Facilies on Call Alert */ unsigned int cc_qsig_add_call_alert_data(unsigned char *data, struct capi_pvt *i, struct ast_channel *c) { @@ -999,10 +1003,14 @@ unsigned int cc_qsig_add_call_alert_data(unsigned char *data, struct capi_pvt *i int protocolvar = 0; const char *connectedname; + data[0] = 0; + if (!i->qsigfeat) return 0; - connectedname = pbx_builtin_getvar_helper(c, "CALLEDNAME"); + if (!(connectedname = pbx_builtin_getvar_helper(c, "CALLEDNAME"))) + return 0; + if (!strlen(connectedname)) return 0;