[asterisk-dev] Caller ID detection in India

Zahir Koradia zahir.koradia at gmail.com
Wed Jan 6 05:56:42 CST 2010


Hi,
I have been trying to get caller ID from a PSTN line with a Sangoma USB FXO
card since past few days. I want through
https://issues.asterisk.org/view.php?id=6683 and got hints on how to
proceed. I am using a Bharti PSTN line and am based in Delhi. I have been
using Astersisk version 1.6.1.4. I was facing two problems:

1. By the time the caller id digits were received on the pstn line ss_thread
had already completed detecting empty caller ID. The caller Id was being
received in between the first and second ring on the line, but by that time
asterisk had moved from PRERING state to RING state.

/* In dahdi_handle_event */
if (ast->_state == AST_STATE_PRERING)
        ast_setstate(ast, AST_STATE_RING);

So I made asterisk wait for the second ring before moving from PRERING state
to RING state. I am not sure if there is a better way to do this.
Suggestions are welcome. I checks the SVN code I had downloaded on 18th
November 2009 and it had the same issue. The patch file for the change is
attached as chan_dahdi.patch. Please let me know if this is an acceptable
way to do the job and if there is value in adding this to the main trunk.

2. The second issue was that some of the DTMF digits in the caller ID were
not being detected. I looked at the DTMF log and found lines like

DTMF end '9' has duration 59 but want minimum 80, emulating on DAHDI/2-1 (I
have generally seen the digit duration near 40ms)

and

DTMF begin ignored '1' on DAHDI/2-1

So I played around with the #defines in channel.c and settled with the
values:
AST_DEFAULT_EMULATE_DTMF_DURATION 30
AST_MIN_DTMF_DURATION 30
AST_MIN_DTMF_GAP 25

At these values I could get all the DTMF digits correctly.
However, I do not quite understand the usage of these parameters and I am
afraid I may be breaking something by changing these parameters to the above
values. I would appreciate it if some one can tell me the purpose of these #
defines and if this is the best way to solve my problem.

Thanks,

Zahir
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-dev/attachments/20100106/9958236c/attachment-0001.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: chan_dahdi.patch
Type: text/x-patch
Size: 2691 bytes
Desc: not available
Url : http://lists.digium.com/pipermail/asterisk-dev/attachments/20100106/9958236c/attachment-0001.bin 


More information about the asterisk-dev mailing list