[asterisk-dev] Caller ID in FXO channel

dpn at switchvoice.com dpn at switchvoice.com
Wed Jan 4 07:47:13 CST 2017


Hi All,

I have managed to narrow the problem. My driver supports FXS and FXO channel.
I register SIP client to Asterisk  and whatever I dial from the SIP I dial(DAHDI/FXS). 
I have analog loopback from FXS to FXS. The incoming calls in the FXO are IVR terminated (see my FXO dialplan on my previous email)
I get DIAHDI pick up FXO on the second call not on the first one. 
(From time to time DAHDI actually pickup on the first call and in this case I do have callerid )
but most of the cases the pickup is on the second call and in those cases I have ${CALLERID(num) empty 

Bellow I include a typical log in my FXS/FXO driver:

Driver receive from DAHDI: "FXS: DAHDI_TXSIG_START", driver sets the SLIC linefeed to "rininging"                     < ------------- first ring
Detect FXO ringing and diver calls dahdi_hooksig(fxo_channel, DAHDI_RXSIG_RING);
Driver receive from DAHDI: "FXS DAHDI_TXSIG_OFFHOOK", driver set the SLIC linefeed to "Forward OHT"
Driver detects the stop rining event and calls dahdi_hooksig(fxo_channel, DAHDI_RXSIG_OFFHOOK);
Driver receive "ioctl DAHDI_TONEDETECT" and returns -ENOTTY

Driver receive from DAHDI: "FXS: DAHDI_TXSIG_START", driver sets the SLIC linefeed to "rininging"                   < ------------- second ring 
Detect FXO ringing and diver calls dahdi_hooksig(fxo_channel, DAHDI_RXSIG_RING);
Driver receive from DAHDI: "FXS DAHDI_TXSIG_OFFHOOK", driver set the SLIC linefeed to "Forward OHT"
Driver detects the stop rining event and calls dahdi_hooksig(fxo_channel, DAHDI_RXSIG_OFFHOOK);
Driver receives from DAHDI "FXO: DAHDI_TXSIG_OFFHOOK" and puts the DAA in offhook state
Driver detects that the SLIC has in offhook state  and calls dahdi_hooksig(&wc.chans[0], DAHDI_RXSIG_OFFHOOK);

---- Conversation established. but caller id is empty -------- 

Anyone being able to point me in the right direction?
It is Asterisk 11.16.0 and dahdi: Version: 2.10.0.1

Best Regards
Dimitar



From: dpn at switchvoice.com 
Sent: Tuesday, January 3, 2017 22:28
To: asterisk-dev at lists.digium.com 
Subject: Fw: Caller ID in FXO channel

Hi All,

First of all happy new year to everyone!

I am developing an FXO driver to use with Asterisk.
My driver is working fine and I can receive and originate calls and I have both ways audio.

I have issue with the callerid however.  I have set in can_dahdi.conf the default bell type starting after the first ring.
For testing I use FXS port which seems to send the calerid properly as it is displayed on an analog phone.
Occasionally I get the callerid (on the incoming calls for the FXO channel ) working but it is once per 20 calls.
It seems enabling Asterisk debug in the CLI makes the callerid detection a bit better as I see it working more often with CLI debug enabled.
This makes me think that I have timing or noise issue. 
On the FXO RING/TIP terminals I do see (with oscilloscope) the callerID FSK signals. It I swith about 5Vpp and yes I see some noise.
Not sure how sensitive the demodulator is. 

Before going into more details I want to ask the mailing list. Probably I have some simple signaling issue like getting the FXO off hook to early or too late.

I have my FXO context like
[fxo]
exten => s,1,Answer                                                                   
exten => s,2, Noop(${CALLERID(num)})                                                         
exten => s,3,Background(/demo-congrats)                                      
exten => s,4,Hangup   

Bellow I include the log for reference. 
Any thoughts or advices how to narrow the problem are welcome!

d-ffffff*CLI> [Jan  2 19:35:56] DEBUG[1672]: chan_dahdi.c:12229 do_monitor: Monitor doohicky got event Ring Begin on channel 2
[Jan  2 19:35:56] DEBUG[1672]: sig_analog.c:3697 analog_handle_init_event: channel (2) - signaling (5) - event (ANALOG_EVENT_RINGBEGIN)
[Jan  2 19:35:56] DEBUG[1672]: chan_dahdi.c:12229 do_monitor: Monitor doohicky got event Ring Begin on channel 2
[Jan  2 19:35:56] DEBUG[1672]: sig_analog.c:3697 analog_handle_init_event: channel (2) - signaling (5) - event (ANALOG_EVENT_RINGBEGIN)
d-ffffff*CLI> [Jan  2 19:35:58] DEBUG[1672]: chan_dahdi.c:12229 do_monitor: Monitor doohicky got event Ring/Answered on channel 2
[Jan  2 19:35:58] DEBUG[1672]: chan_dahdi.c:12229 do_monitor: Monitor doohicky got event Ring/Answered on channel 2
d-ffffff*CLI> [Jan  2 19:35:58] DEBUG[1672]: sig_analog.c:3697 analog_handle_init_event: channel (2) - signaling (5) - event (ANALOG_EVENT_RINGOFFHOOK)
[Jan  2 19:35:58] DEBUG[1672]: sig_analog.c:3697 analog_handle_init_event: channel (2) - signaling (5) - event (ANALOG_EVENT_RINGOFFHOOK)
d-ffffff*CLI> [Jan  2 19:35:58] DEBUG[1672][C-00000007]: dsp.c:482 ast_tone_detect_init: Setup tone 1100 Hz, 500 ms, block_size=160, hits_required=21
[Jan  2 19:35:58] DEBUG[1672][C-00000007]: dsp.c:482 ast_tone_detect_init: Setup tone 1100 Hz, 500 ms, block_size=160, hits_required=21
d-ffffff*CLI> [Jan  2 19:35:58] DEBUG[1672][C-00000007]: dsp.c:482 ast_tone_detect_init: Setup tone 2100 Hz, 2600 ms, block_size=160, hits_required=116
[Jan  2 19:35:58] DEBUG[1672][C-00000007]: dsp.c:482 ast_tone_detect_init: Setup tone 2100 Hz, 2600 ms, block_size=160, hits_required=116
d-ffffff*CLI> [Jan  2 19:35:58] DEBUG[1696]: sig_analog.c:1764 __analog_ss_thread: __analog_ss_thread 2
[Jan  2 19:35:58] DEBUG[1696]: sig_analog.c:1764 __analog_ss_thread: __analog_ss_thread 2
    -- Starting simple switch on 'DAHDI/2-1'
d-ffffff*CLI>     -- Starting simple switch on 'DAHDI/2-1'
[Jan  2 19:36:02] DEBUG[1696][C-00000007]: pbx.c:4883 pbx_extension_helper: Launching 'Answer'
[Jan  2 19:36:02] DEBUG[1696][C-00000007]: pbx.c:4883 pbx_extension_helper: Launching 'Answer'
d-ffffff*CLI>     -- Executing [s at penev_fxo:1] Answer("DAHDI/2-1", "") in new stack
    -- Executing [s at penev_fxo:1] Answer("DAHDI/2-1", "") in new stack
d-ffffff*CLI> [Jan  2 19:36:02] DEBUG[1696][C-00000007]: sig_analog.c:1497 analog_answer: analog_answer 2
[Jan  2 19:36:02] DEBUG[1696][C-00000007]: sig_analog.c:1497 analog_answer: analog_answer 2
d-ffffff*CLI> [Jan  2 19:36:02] DEBUG[1696][C-00000007]: sig_analog.c:1528 analog_answer: Took DAHDI/2-1 off hook
[Jan  2 19:36:02] DEBUG[1696][C-00000007]: sig_analog.c:1528 analog_answer: Took DAHDI/2-1 off hook
d-ffffff*CLI> [Jan  2 19:36:02] DEBUG[1696][C-00000007]: chan_dahdi.c:5061 dahdi_enable_ec: No echo cancellation requested
[Jan  2 19:36:02] DEBUG[1696][C-00000007]: chan_dahdi.c:5061 dahdi_enable_ec: No echo cancellation requested
d-ffffff*CLI> [Jan  2 19:36:02] DEBUG[1696][C-00000007]: chan_dahdi.c:5077 dahdi_train_ec: No echo training requested
[Jan  2 19:36:02] DEBUG[1696][C-00000007]: chan_dahdi.c:5077 dahdi_train_ec: No echo training requested
d-ffffff*CLI> [Jan  2 19:36:02] DEBUG[1696][C-00000007]: chan_dahdi.c:9656 dahdi_indicate: Requested indication -1 on channel DAHDI/2-1
[Jan  2 19:36:02] DEBUG[1696][C-00000007]: chan_dahdi.c:9656 dahdi_indicate: Requested indication -1 on channel DAHDI/2-1
d-ffffff*CLI> [Jan  2 19:36:02] DEBUG[1696][C-00000007]: pbx.c:4883 pbx_extension_helper: Launching 'NoOp'
[Jan  2 19:36:02] DEBUG[1696][C-00000007]: pbx.c:4883 pbx_extension_helper: Launching 'NoOp'
    -- Executing [s at penev_fxo:2] NoOp("DAHDI/2-1", "") in new stack
d-ffffff*CLI>     -- Executing [s at penev_fxo:2] NoOp("DAHDI/2-1", "") in new stack
[Jan  2 19:36:02] DEBUG[1696][C-00000007]: pbx.c:4883 pbx_extension_helper: Launching 'BackGround'
[Jan  2 19:36:02] DEBUG[1696][C-00000007]: pbx.c:4883 pbx_extension_helper: Launching 'BackGround'
    -- Executing [s at penev_fxo:3] BackGround("DAHDI/2-1", "/demo-congrats") in new stack
d-ffffff*CLI>     -- Executing [s at penev_fxo:3] BackGround("DAHDI/2-1", "/demo-congrats") in new stack
    -- <DAHDI/2-1> Playing '/demo-congrats.ulaw' (language 'en')
d-ffffff*CLI>     -- <DAHDI/2-1> Playing '/demo-congrats.ulaw' (language 'en')
[Jan  2 19:36:02] DEBUG[1696][C-00000007]: sig_analog.c:3572 analog_exception: analog_exception 2
[Jan  2 19:36:02] DEBUG[1696][C-00000007]: sig_analog.c:3572 analog_exception: analog_exception 2
d-ffffff*CLI> [Jan  2 19:36:02] DEBUG[1696][C-00000007]: sig_analog.c:3666 analog_exception: Exception on 7, channel 2
[Jan  2 19:36:02] DEBUG[1696][C-00000007]: sig_analog.c:3666 analog_exception: Exception on 7, channel 2
d-ffffff*CLI> [Jan  2 19:36:02] DEBUG[1696][C-00000007]: sig_analog.c:2679 __analog_handle_event: __analog_handle_event 2
[Jan  2 19:36:02] DEBUG[1696][C-00000007]: sig_analog.c:2679 __analog_handle_event: __analog_handle_event 2
d-ffffff*CLI> [Jan  2 19:36:02] DEBUG[1696][C-00000007]: sig_analog.c:2706 __analog_handle_event: Got event ANALOG_EVENT_RINGOFFHOOK(2) on channel 2 (index 0)
[Jan  2 19:36:02] DEBUG[1696][C-00000007]: sig_analog.c:2706 __analog_handle_event: Got event ANALOG_EVENT_RINGOFFHOOK(2) on channel 2 (index 0)
d-ffffff*CLI> [Jan  2 19:36:02] WARNING[1696][C-00000007]: sig_analog.c:3103 __analog_handle_event: Ring/Off-hook in strange state 6 on channel 2
[Jan  2 19:36:02] WARNING[1696][C-00000007]: sig_analog.c:3103 __analog_handle_event: Ring/Off-hook in strange state 6 on channel 2
d-ffffff*CLI> [Jan  2 19:36:28] DEBUG[1696][C-00000007]: sig_analog.c:3572 analog_exception: analog_exception 2
[Jan  2 19:36:28] DEBUG[1696][C-00000007]: sig_analog.c:3666 analog_exception: Exception on 7, channel 2
[Jan  2 19:36:28] DEBUG[1696][C-00000007]: sig_analog.c:2679 __analog_handle_event: __analog_handle_event 2
[Jan  2 19:36:28] DEBUG[1696][C-00000007]: sig_analog.c:2706 __analog_handle_event: Got event ANALOG_EVENT_ONHOOK(1) on channel 2 (index 0)
[Jan  2 19:36:28] DEBUG[1696][C-00000007]: pbx.c:6572 __ast_pbx_run: Spawn extension (penev_fxo,s,3) exited non-zero on 'DAHDI/2-1'
  == Spawn extension (penev_fxo, s, 3) exited non-zero on 'DAHDI/2-1'
[Jan  2 19:36:28] DEBUG[1696][C-00000007]: channel.c:2661 ast_softhangup_nolock: Soft-Hanging up channel 'DAHDI/2-1'
[Jan  2 19:36:28] DEBUG[1696][C-00000007]: channel.c:2840 ast_hangup: Hanging up channel 'DAHDI/2-1'
[Jan  2 19:36:28] DEBUG[1696][C-00000007]: chan_dahdi.c:6325 dahdi_hangup: dahdi_hangup(DAHDI/2-1)
[Jan  2 19:36:28] DEBUG[1696][C-00000007]: sig_analog.c:1280 analog_hangup: analog_hangup 2
[Jan  2 19:36:28] DEBUG[1696][C-00000007]: sig_analog.c:1303 analog_hangup: Hangup: channel: 2 index = 0, normal = 1, callwait = 0, thirdcall = 0
[Jan  2 19:36:28] DEBUG[1696][C-00000007]: sig_analog.c:3572 analog_exception: analog_exception 2
[Jan  2 19:36:28] DEBUG[1696][C-00000007]: sig_analog.c:3666 analog_exception: Exception on 7, channel 2
[Jan  2 19:36:28] DEBUG[1696][C-00000007]: sig_analog.c:2679 __analog_handle_event: __analog_handle_event 2
[Jan  2 19:36:28] DEBUG[1696][C-00000007]: sig_analog.c:2706 __analog_handle_event: Got event ANALOG_EVENT_ONHOOK(1) on channel 2 (index 0)
[Jan  2 19:36:28] DEBUG[1696][C-00000007]: pbx.c:6572 __ast_pbx_run: Spawn extension (penev_fxo,s,3) exited non-zero on 'DAHDI/2-1'
  == Spawn extension (penev_fxo, s, 3) exited non-zero on 'DAHDI/2-1'
[Jan  2 19:36:28] DEBUG[1696][C-00000007]: channel.c:2661 ast_softhangup_nolock: Soft-Hanging up channel 'DAHDI/2-1'
[Jan  2 19:36:28] DEBUG[1696][C-00000007]: channel.c:2840 ast_hangup: Hanging up channel 'DAHDI/2-1'
[Jan  2 19:36:28] DEBUG[1696][C-00000007]: chan_dahdi.c:6325 dahdi_hangup: dahdi_hangup(DAHDI/2-1)
[Jan  2 19:36:28] DEBUG[1696][C-00000007]: sig_analog.c:1280 analog_hangup: analog_hangup 2
[Jan  2 19:36:28] DEBUG[1696][C-00000007]: sig_analog.c:1303 analog_hangup: Hangup: channel: 2 index = 0, normal = 1, callwait = 0, thirdcall = 0
d-ffffff*CLI> [Jan  2 19:36:28] DEBUG[1696][C-00000007]: chan_dahdi.c:6923 dahdi_setoption: Set option TONE VERIFY, mode: OFF(0) on DAHDI/2-1
[Jan  2 19:36:28] DEBUG[1696][C-00000007]: chan_dahdi.c:6923 dahdi_setoption: Set option TONE VERIFY, mode: OFF(0) on DAHDI/2-1
d-ffffff*CLI> [Jan  2 19:36:28] DEBUG[1696][C-00000007]: chan_dahdi.c:6933 dahdi_setoption: Set option TDD MODE, value: OFF(0) on DAHDI/2-1
[Jan  2 19:36:28] DEBUG[1696][C-00000007]: chan_dahdi.c:6933 dahdi_setoption: Set option TDD MODE, value: OFF(0) on DAHDI/2-1
d-ffffff*CLI> [Jan  2 19:36:28] DEBUG[1696][C-00000007]: sig_analog.c:785 analog_update_conf: Updated conferencing on 2, with 0 conference users
[Jan  2 19:36:28] DEBUG[1696][C-00000007]: sig_analog.c:785 analog_update_conf: Updated conferencing on 2, with 0 conference users
d-ffffff*CLI>     -- Hanging up on 'DAHDI/2-1'
    -- Hanging up on 'DAHDI/2-1'
d-ffffff*CLI>     -- Hungup 'DAHDI/2-1'

Best Regards
Dimitar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20170104/cc07e703/attachment-0001.html>


More information about the asterisk-dev mailing list