Merge pull request #171 in FS/freeswitch from ~MBRANCA/freeswitch:bugfix/FS-7209-improve-ani-ton-and-type-when-not to master

* commit '3cd62df96f78a0ea3255c4fced2e2f32f97c0a42':
  If ANI ton is not interpreted correctly by libpri, fallback to calling ton/type.
This commit is contained in:
Moises Silva 2015-01-28 10:35:09 -06:00
commit 98de925e46
1 changed files with 10 additions and 2 deletions

View File

@ -1915,8 +1915,16 @@ static int on_ring(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event
ftdm_set_string(caller_data->dnis.digits, (char *)pevent->ring.callednum);
ftdm_set_string(caller_data->rdnis.digits, (char *)pevent->ring.redirectingnum);
caller_data->ani.type = pevent->ring.callingplanani >> 4;
caller_data->ani.plan = pevent->ring.callingplanani & 0x0F;
if (pevent->ring.callingplanani != -1) {
caller_data->ani.type = pevent->ring.callingplanani >> 4;
caller_data->ani.plan = pevent->ring.callingplanani & 0x0F;
} else {
/* the remote party did not sent a valid (according to libpri) ANI ton,
* so let's use the callingplan ton/type and hope is correct.
*/
caller_data->ani.type = pevent->ring.callingplan >> 4;
caller_data->ani.plan = pevent->ring.callingplan & 0x0F;
}
caller_data->cid_num.type = pevent->ring.callingplan >> 4;
caller_data->cid_num.plan = pevent->ring.callingplan & 0x0F;