From d0c0964067a2e6192f96a314f68c0653f3bb37e1 Mon Sep 17 00:00:00 2001 From: MelwareDE Date: Thu, 17 May 2007 16:10:04 +0000 Subject: [PATCH] QSIG: - minor bug fix on name decoding - corrected callerid handling in call transfer --- README.qsig | 2 +- chan_capi_qsig_asn197no.c | 2 +- chan_capi_qsig_core.c | 8 +++++++- chan_capi_qsig_ecma.c | 11 +++++++++-- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/README.qsig b/README.qsig index ecfdc11..6103ca4 100644 --- a/README.qsig +++ b/README.qsig @@ -97,4 +97,4 @@ Set qsig to one of the following values, which corresponds to your configuration ToDo List: ========== -- Support for inbound routing \ No newline at end of file +- Support for inbound routing diff --git a/chan_capi_qsig_asn197no.c b/chan_capi_qsig_asn197no.c index 7fcb3e7..16f0825 100644 --- a/chan_capi_qsig_asn197no.c +++ b/chan_capi_qsig_asn197no.c @@ -73,7 +73,7 @@ unsigned int cc_qsig_asn197no_get_name(char *buf, int buflen, unsigned int *bufd if (data[myidx++] == ASN1_OCTETSTRING) { /* should be so */ namelength = cc_qsig_asn1_get_string((unsigned char *)buf, buflen, &data[myidx]); - myidx += data[myidx-1]; /* is this safe? */ + myidx += namelength + 1; } else { cc_verbose(1, 1, VERBOSE_PREFIX_4 " Namestruct not ECMA conform (String expected)\n"); break; diff --git a/chan_capi_qsig_core.c b/chan_capi_qsig_core.c index bd104ab..ac6c774 100644 --- a/chan_capi_qsig_core.c +++ b/chan_capi_qsig_core.c @@ -27,8 +27,14 @@ #include "chan_capi_qsig_asn197ade.h" #include "chan_capi_qsig_asn197no.h" -/* +/** * Encodes an ASN.1 string + * + * @param buf destination pointer for string + * @param idx index points to string position in buffer + * @param data string + * @param datalen string length + * @return always zero */ unsigned int cc_qsig_asn1_add_string(unsigned char *buf, int *idx, char *data, int datalen) { diff --git a/chan_capi_qsig_ecma.c b/chan_capi_qsig_ecma.c index bb4ed1b..02a1767 100644 --- a/chan_capi_qsig_ecma.c +++ b/chan_capi_qsig_ecma.c @@ -292,8 +292,15 @@ void cc_qsig_encode_ecma_calltransfer(unsigned char * buf, unsigned int *idx, st icanswer = ccanswer[0] - 0x30; } } else { - cid = strdup(i->owner->cid.cid_num); - cidlen = strlen(cid); +/* cid = strdup(i->owner->cid.cid_num);*/ /* Here we get the Asterisk extension */ + if (info) { /* info should be >0 on outbound channel */ + cid = strdup(i->cid); + cidlen = strlen(cid); + } else { /* have to build first facility - send destination number back to inbound channel */ + struct capi_pvt *ii = capi_find_interface_by_plci(i->qsig_data.partner_plci); + cid = strdup(ii->dnid); + cidlen = strlen(cid); + } if (!info) icanswer = i->qsig_data.calltransfer_onring % 1;