Need help with FXO, can not dial in/out

Hi, I got a gateway with 4 FXS and 4 FXO.
I can register them one by one with Asterisk sip.conf.
4 FXS (8000-8003) and 4 FXO (8004-8007):

sip show peers
Name/username Host Dyn Forcerport ACL Port Status
8000/8000 192.168.1.104 D A 5060 Unmonitored
8001/8001 192.168.1.104 D A 5060 Unmonitored
8002/8002 192.168.1.104 D A 5060 Unmonitored
8003/8003 192.168.1.104 D A 5060 Unmonitored
8004/8004 192.168.1.104 D A 5060 Unmonitored
8005/8005 192.168.1.104 D A 5060 Unmonitored
8006/8006 192.168.1.104 D A 5060 Unmonitored
8007/8007 192.168.1.104 D A 5060 Unmonitored

But I could not dial out or dial in using FXO.

[outgoing]
exten => _9.,1,Dial(SIP/8007/${EXTEN:1})
exten => _9.,2,Busy()

When I dialed from SIP phone: 987766788

== Using SIP RTP CoS mark 5
– Executing [987766788@users:1] Dial(“SIP/801-00000014”, “SIP/8007/87766788”) in new stack
== Using SIP RTP CoS mark 5
– Called SIP/8007/87766788
– SIP/8007-00000015 is circuit-busy
== Everyone is busy/congested at this time (1:0/1/0)
– Auto fallthrough, channel ‘SIP/801-00000014’ status is ‘CONGESTION’

Thanks for help.
Dave

Another question:

For dialing out, how to tell asterisk to use any available FXO?
Thanks,

Dave

[quote=“javaone9”]For dialing out, how to tell asterisk to use any available FXO?
[/quote]
For real FXOs, you use groups in chan_dahdi.conf.

The best SIP solutions would depend on the gateway doing the hunting. As one gateway handles two logical trunks, this may be difficult. Otherwise you have to treat things as individual extensions, and have your dialplan try each in turn, checking hangup cause to see if the call failed through something that would indicate a busy trunk member, rather than a busy destination.

Your first problem is with the gateway, although capturing a SIP trace of the value of ${HANGUPCAUSE} may indicate a more precise reason for the failure.

Thanks for reply.

For FXO in gateway that is registered as SIP, does it use dadhi?
is it the same as FXO in analog card?

Since there was no error in the gateway log, possiblly configuration issue in
asterisk side? I did not change other configuration files except sip.conf and extensions.conf,
registering FXO/FXS for the gateway.

capturing a SIP trace of the value of ${HANGUPCAUSE}
I am new to asterisk. how to capture the value?

Thanks for help.
Dave

Your FXO in SIP is a remote SIP back to back user agent to Asterisk, which is why hunting needs to done there. Dahdi is not involved. Askterisk has no idea that it contains an FXO interface.

To capture hangup cause add a dialplan line after the one that calls Dial, that runs Noop(HANGUP CAUSE=${HANGUPCAUSE})

Make sure that it has a consecutive priority number. If the dialplan uses n, use n, otherwise you will need to do some renumbering.

Set verbosity to at least 3, with core set verbose 3.

To get a SIP trace, using something like wireshark, or use sip set debug on (the latter would be needed for a formal bug report).

Thanks for help.

I registered FXO 4 of the gateway(IP:192.168.1.104) with asterisk as 8007.

sip.conf

[8007]
type=friend
host=dynamic
secret=8007
context=incoming
deny=0.0.0.0/0
permit=192.168.1.0/255.255.255.0

sip show peers
8007/8007 192.168.1.104 D A 5060 Unmonitored

extensions.conf

[incoming]
exten => s,1,Dial(SIP/801,20)

When calling into the FXO 4, I expected to see some output from CLI, and dialed the SIP/801.
but nothing happened. Do I need to do anything else with the gateway?

Thanks for help
Dave

What error messages do you get. My guess is that you need 8007 instead of s.

I changed s to 8007. no luck.
no error message from CLI, nothing.

the gateway FXO 4(SIP/8007) is conntected to PBX(tranditional) extension 603.
When I dialed 603 from another extension 608, I heard ringing tone. but nothing happened.
no messages.

Thanks for help.
Dave

The lack of messages suggests the call isn’t reaching Asterisk, but, to be sure, you need to get a SIP protocol trace.

Thanks for suggestion.

I made some progress. I used the following IP address instead of SIP registration.
gateway ip: 192.168.1.104.

I like to put calls from fxo and fxs into different context. In the gateway router:
FXO X. ROUTE IP 192.168.1.22:5060
FXS X. ROUTE IP 192.168.1.22:5061

[gateway-fxo]
context=incoming
type=friend
host=192.168.1.104
port=5060
dtmfmode=rfc2833
disallow=all
allow=ulaw

[gateway-fxs]
context=users
type=friend
host=192.168.1.104
port=5061
dtmfmode=rfc2833
disallow=all
allow=ulaw

I called 801 from FXS, it seems port 5061 is not working, and call did not go to asterisk.
UDP port 5061 is open on Asterisk server.

Is there a way to put FXS and FXO (gateway) in different contexts?
I know SIP registration can do that. But 1000 SIP registrations is not as easy.

Thanks,
Dave