Sip peer works but friend doesnt

I am trying to install a conference server on amazon. I have make good progress where I can call a commercial voip service and that DID is forwarded to my asterisk box. This is via the voipms section in sip.conf and works fine. Confbridge is invoked and user can join conference this way.

However if I want to call directly to the box via a sip softphone, I can see in the logs that the confbridge is answering the call and requesting a pin, but I can’t hear anything on the sip phone, and if I enter the pin anyways I can see this does not seem to be retransmitted back to the server.

What could be the problem here?

Thanks for any suggestions.

sip.conf
[general]
context=default
allowguest=no
disallow=all
allow=gsm
allow=ulaw
allow=alaw
qualify=yes
canreinvite=no

;nat=force_rport,comedia
nat=yes

;externip=khbridge.selfip.org
;localnet=172.31.38.0/255.255.240.0

udpbindaddr=0.0.0.0:5060
tcpenable=yes
tcpbinaddr=0.0.0.0:5060

[khbridge]
type=friend
context=sip-client
host=dynamic
secret=xxxx
permit=0.0.0.0/0
transport=tcp
;transport=udp

[voipms]
type=peer
context=voipms-incoming
host=vancouver.voip.ms
;canreinvite=nonat

extensions.conf
[general]
static=yes
writeprotect=no
autofallthrough=yes
clearglobalvars=no
extenpatternmatchnew=no

[globals]
CONSOLE => Console/dsp
;IAXINFO => guest
;TRUNK => DAHDI/G2
;TRUNKMSD => 1

[voipms-incoming]
exten => khbridge, 1, Set(CHANNEL(language)=en)
exten => khbridge, n, Set(CHANNEL(musicclass)=default)
exten => khbridge, n, Ringing
exten => khbridge, n, Wait(1)
exten => khbridge, n, Answer()
exten => khbridge, n, Ringing
exten => khbridge, n, Wait(1)
exten => khbridge, n, Confbridge(kh_bridge,kh_bridge,default_user,user_menu)
exten => khbridge, n, Hangup

[sip-client]
exten => 1914,1,Answer()
exten => 1914,n,Confbridge(kh_bridge,kh_bridge,default_user,user_menu)
exten => 6070,1,Answer()
exten => 6070,n,Confbridge(kh_bridge,kh_bridge,admin,admin_menu)

[default]

[public]

/var/log/asterisk/messages
[Sep 27 04:32:00] VERBOSE[2271][C-00000001] pbx.c: – Executing [1914@sip-client:1] Answer(“SIP/khbridge-00000000”, “”) in new stack
[Sep 27 04:32:01] VERBOSE[2271][C-00000001] pbx.c: – Executing [1914@sip-client:2] ConfBridge(“SIP/khbridge-00000000”, “kh_bridge,kh_bridge,default_user,user_menu”) in new stack
[Sep 27 04:32:01] VERBOSE[2271][C-00000001] file.c: – <SIP/khbridge-00000000> Playing ‘conf-getpin.gsm’ (language ‘en’)
[Sep 27 04:32:13] VERBOSE[2271][C-00000001] file.c: – <SIP/khbridge-00000000> Playing ‘conf-invalidpin.gsm’ (language ‘en’)
[Sep 27 04:32:16] VERBOSE[2271][C-00000001] file.c: – <SIP/khbridge-00000000> Playing ‘conf-getpin.gsm’ (language ‘en’)
[Sep 27 04:32:29] VERBOSE[2271][C-00000001] file.c: – <SIP/khbridge-00000000> Playing ‘conf-invalidpin.gsm’ (language ‘en’)
[Sep 27 04:32:32] VERBOSE[2271][C-00000001] file.c: – <SIP/khbridge-00000000> Playing ‘conf-getpin.gsm’ (language ‘en’)
[Sep 27 04:32:45] VERBOSE[2271][C-00000001] file.c: – <SIP/khbridge-00000000> Playing ‘conf-invalidpin.gsm’ (language ‘en’)
[Sep 27 04:32:48] VERBOSE[2271][C-00000001] pbx.c: == Spawn extension (sip-client, 1914, 2) exited non-zero on ‘SIP/khbridge-00000000’
[root@ip-172-31-38-152 asterisk]#

type=peer is normally the correct thing to use, even though many cookbook solutions seem to use type=friend. Type=friend can cause problems when the same caller ID is used on both ends of a trunk.

Basically, it is not worth analysing your problem unless you can demonstrate that the obvious solution is not applicable in your case.

However, looking at the trace, you are well past the point where type=friend/peer would make a difference. I suspect you are trying to do inband DTMF over GSM.

Also, you have at least one deprecated option and nat= is something that should be set according to your specific needs, not on a cookbook basis.

Check you dtmf settings

[quote]dtmfmode = rfc2833 Set default dtmfmode for sending DTMF. Default: rfc2833
Other options:
info : SIP INFO messages (application/dtmf-relay)
shortinfo : SIP INFO messages (application/dtmf)
inband : Inband audio (requires 64 kbit codec -alaw, ulaw)
auto : Use rfc2833 if offered, inband otherwise[/quote]

And as David55 says, your are using a drepecated option in your nat setting.

[quote]nat parameters

nat = no                 Do no special NAT handling other than RFC3581
nat = force_rport        Pretend there was an rport parameter even if there wasn't
nat = comedia            Send media to the port Asterisk received it from regardless
                       of where the SDP says to send it.
nat = auto_force_rport  ; Set the force_rport option if Asterisk detects NAT (default)
nat = auto_comedia       Set the comedia option if Asterisk detects NAT

The nat settings can be combined.[/quote]

I was actually thinking about canreinvite!

With nat=yes, He will have this type of warning :

[quote][Sep 28 12:21:49] WARNING[1070]: sip/config_parser.c:812 sip_parse_nat_option: nat=yes is deprecated, use nat=force_rport,comedia instead
[/quote]

And related to careinvite option you right :

canreinvite= was renamed to directmedia= in Asterisk 1.6.2 to more accurately describe what this setting does. See also the closely related setting directrtpsetup.