[Asterisk-Users] Setvar SIP_CODEC

Luis Benavente luisbe at bts-usa.com
Tue Oct 21 12:19:23 MST 2003


Martin,
	Thank you for replaying. That's exactly what I am trying to do, but the
call never gets answered because is dropped before that due codec
incompatibility.
	Please see what the debug shows with my comments in line.

	Regards,

Luis


==================================================
==================================================
INVITE from the phone with G729 as preferred codec 
==================================================
==================================================

Sip read: 
INVITE sip:17862862705 at 192.168.1.111 SIP/2.0
Via: SIP/2.0/UDP 192.168.1.13:5060
From: "User ID"
<sip:7601 at 192.168.1.111>;tag=000b5f800a9b010359818116-229fbd39
To: <sip:17862862705 at 192.168.1.111>
Call-ID: 000b5f80-0a9b0302-363288dd-7cacb51e at 192.168.1.13
Date: Tue, 21 Oct 2003 17:38:25 GMT
CSeq: 101 INVITE
User-Agent: CSCO/4
Contact: sip:7601 at 192.168.1.13:5060
Expires: 180
Content-Type: application/sdp
Content-Length: 189
Accept: application/sdp

v=0
o=Cisco-SIPUA 727 26778 IN IP4 192.168.1.13
s=SIP Call
c=IN IP4 192.168.1.13
t=0 0
m=audio 22436 RTP/AVP 18 0 8
a=rtpmap:18 G729/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000

==================================================
==================================================
Asterisk asks for authentication 
==================================================
==================================================

13 headers, 9 lines
Using latest request as basis request
Sending to 192.168.1.13 : 5060 (non-NAT)
Found audio format UNKN
Found audio format UNKN
Found audio format ALAW
Found description format G729
Found description format PCMU
Found description format PCMA
Capabilities: us - 2147483647, them - 268/0, combined - 268
Non-codec capabilities: us - 1, them - 0, combined - 0
DEBUG[114696]: File chan_sip.c, Line 3854 (check_user): Setting NAT on
RTP to 0
Reliably Transmitting (no NAT):
SIP/2.0 407 Proxy Authentication Required
Via: SIP/2.0/UDP 192.168.1.13:5060
From: "User ID"
<sip:7601 at 192.168.1.111>;tag=000b5f800a9b010359818116-229fbd39
To: <sip:17862862705 at 192.168.1.111>;tag=as225c5d68
Call-ID: 000b5f80-0a9b0302-363288dd-7cacb51e at 192.168.1.13
CSeq: 101 INVITE
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER
Contact: 
Proxy-Authenticate: Digest realm="asterisk", nonce="2a32fc8f"
Content-Length: 0


 to 192.168.1.13:5060
Sip read: 
ACK sip:17862862705 at 192.168.1.111 SIP/2.0
Via: SIP/2.0/UDP 192.168.1.13:5060
From: "User ID"
<sip:7601 at 192.168.1.111>;tag=000b5f800a9b010359818116-229fbd39
To: <sip:17862862705 at 192.168.1.111>;tag=as225c5d68
Call-ID: 000b5f80-0a9b0302-363288dd-7cacb51e at 192.168.1.13
Date: Tue, 21 Oct 2003 17:38:25 GMT
CSeq: 101 ACK
Content-Length: 0


8 headers, 0 lines
DEBUG[114696]: File chan_sip.c, Line 548 (__sip_ack): Stopping
retransmission on '000b5f80-0a9b0302-363288dd-7cacb51e at 192.168.1.13' of
Response 101: Found


==================================================
==================================================
Phone sends authentication 
==================================================
==================================================

Sip read: 
INVITE sip:17862862705 at 192.168.1.111 SIP/2.0
Via: SIP/2.0/UDP 192.168.1.13:5060
From: "User ID"
<sip:7601 at 192.168.1.111>;tag=000b5f800a9b010359818116-229fbd39
To: <sip:17862862705 at 192.168.1.111>
Call-ID: 000b5f80-0a9b0302-363288dd-7cacb51e at 192.168.1.13
Date: Tue, 21 Oct 2003 17:38:25 GMT
CSeq: 102 INVITE
User-Agent: CSCO/4
Contact: sip:7601 at 192.168.1.13:5060
Proxy-Authorization: Digest
username="7601",realm="asterisk",uri="sip:192.168.1.111",response="f35280ce287b45e2abdcb832d7244198",nonce="2a32fc8f",algorithm=md5
Expires: 180
Content-Type: application/sdp
Content-Length: 189

v=0
o=Cisco-SIPUA 727 26778 IN IP4 192.168.1.13
s=SIP Call
c=IN IP4 192.168.1.13
t=0 0
m=audio 22436 RTP/AVP 18 0 8
a=rtpmap:18 G729/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000

13 headers, 9 lines
Using latest request as basis request
Sending to 192.168.1.13 : 5060 (non-NAT)
Found audio format UNKN
Found audio format UNKN
Found audio format ALAW
Found description format G729
Found description format PCMU
Found description format PCMA
Capabilities: us - 2147483647, them - 268/0, combined - 268
Non-codec capabilities: us - 1, them - 0, combined - 0
DEBUG[114696]: File chan_sip.c, Line 3854 (check_user): Setting NAT on
RTP to 0
DEBUG[114696]: File chan_sip.c, Line 4904 (handle_request): Check for
res for 7601
DEBUG[114696]: File chan_sip.c, Line 973 (find_user): Call from user
'7601' is 1 out of 0
Looking for 17862862705 in intern
DEBUG[114696]: File chan_sip.c, Line 3307 (build_route): build_route:
Contact hop: sip:7601 at 192.168.1.13:5060list_route: hop:
<sip:7601 at 192.168.1.13:5060>
Transmitting (no NAT):

==================================================================
==================================================================
Asterisk has authorized the call and sends the Trying to the phone
==================================================================
==================================================================

SIP/2.0 100 Trying
Via: SIP/2.0/UDP 192.168.1.13:5060
From: "User ID"
<sip:7601 at 192.168.1.111>;tag=000b5f800a9b010359818116-229fbd39
To: <sip:17862862705 at 192.168.1.111>;tag=as2ae322ec
Call-ID: 000b5f80-0a9b0302-363288dd-7cacb51e at 192.168.1.13
CSeq: 102 INVITE
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER
Contact: <sip:17862862705 at 192.168.1.111>
Content-Length: 0

==========================================================================
==========================================================================
Here, seems to execute the SetVar function and seizes the outbound
channel
==========================================================================
==========================================================================

 to 192.168.1.13:5060
    -- Executing SetVar("SIP/7601-23d0", "SIP_CODEC=ulaw") in new stack
    -- Executing Dial("SIP/7601-23d0", "Zap/g1/17862862705") in new
stack
DEBUG[311314]: File chan_zap.c, Line 1432 (zt_call): Dialing
'17862862705'
DEBUG[311314]: File chan_zap.c, Line 1478 (zt_call): Deferring
dialing...
    -- Called g1/17862862705
DEBUG[311314]: File chan_zap.c, Line 3204 (zt_exception): Exception on
20, channel 1
DEBUG[311314]: File chan_zap.c, Line 2638 (zt_handle_event): Got event
Wink/Flash(3) on channel 1 (index 0)
DEBUG[311314]: File chan_zap.c, Line 3204 (zt_exception): Exception on
20, channel 1
DEBUG[311314]: File chan_zap.c, Line 2638 (zt_handle_event): Got event
Hook Transition Complete(12) on channel 1 (index 0)
DEBUG[311314]: File chan_zap.c, Line 3103 (zt_handle_event): Got hook
complete in MF FGD, waiting for wink now on channel 1
DEBUG[311314]: File chan_zap.c, Line 3204 (zt_exception): Exception on
20, channel 1
DEBUG[311314]: File chan_zap.c, Line 2638 (zt_handle_event): Got event
Dial Complete(9) on channel 1 (index 0)
DEBUG[311314]: File chan_zap.c, Line 1053 (zt_enable_ec): Enabled echo
cancellation on channel 1

============================================
============================================
Now * sends again G729 as the preferred code
============================================
============================================


We're at 192.168.1.111 port 13596
Answering with preferred capability 2147483647
Answering with preferred capability 256
Answering with preferred capability 4
Transmitting (no NAT):
SIP/2.0 183 Session Progress
Via: SIP/2.0/UDP 192.168.1.13:5060
From: "User ID"
<sip:7601 at 192.168.1.111>;tag=000b5f800a9b010359818116-229fbd39
To: <sip:17862862705 at 192.168.1.111>;tag=as2ae322ec
Call-ID: 000b5f80-0a9b0302-363288dd-7cacb51e at 192.168.1.13
CSeq: 102 INVITE
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER
Contact: <sip:17862862705 at 192.168.1.111>
Content-Type: application/sdp
Content-Length: 163

v=0
o=root 12788 12788 IN IP4 192.168.1.111
s=session
c=IN IP4 192.168.1.111
t=0 0
m=audio 13596 RTP/AVP 18 0
a=rtpmap:18 G729/8000
a=rtpmap:0 PCMU/8000

 to 192.168.1.13:5060

==========================================
==========================================
As * can't decode G729, drops the call
==========================================
==========================================

DEBUG[311314]: File rtp.c, Line 1007 (ast_rtp_write): Ooh, format
changed from UNKN to ULAW
DEBUG[311314]: File chan_sip.c, Line 1437 (sip_rtp_read): Oooh, format
changed to 256
NOTICE[311314]: File channel.c, Line 1476 (ast_set_read_format): Unable
to find a path from G729A to ULAW
NOTICE[311314]: File channel.c, Line 1446 (ast_set_write_format): Unable
to find a path from ULAW to G729A
WARNING[311314]: File chan_zap.c, Line 3542 (zt_write): Cannot handle
frames in 256 format
WARNING[311314]: File app_dial.c, Line 317 (wait_for_answer): Unable to
forward voice
DEBUG[311314]: File chan_zap.c, Line 1629 (zt_hangup): Hangup: channel:
1 index = 0, normal = 20, callwait = -1, thirdcall = -1
DEBUG[311314]: File chan_zap.c, Line 1069 (zt_disable_ec): disabled echo
cancellation on channel 1
DEBUG[311314]: File chan_zap.c, Line 1996 (zt_setoption): Set option TDD
MODE, value: OFF(0) on Zap/1-1
DEBUG[311314]: File chan_zap.c, Line 1028 (update_conf): Updated
conferencing on 1, with 0 conference users
    -- Hungup 'Zap/1-1'
  == No one is available to answer at this time
Sip read: 
CANCEL sip:17862862705 at 192.168.1.111 SIP/2.0
Via: SIP/2.0/UDP 192.168.1.13:5060
From: "User ID"
<sip:7601 at 192.168.1.111>;tag=000b5f800a9b010359818116-229fbd39
To: <sip:17862862705 at 192.168.1.111>
Call-ID: 000b5f80-0a9b0302-363288dd-7cacb51e at 192.168.1.13
Date: Tue, 21 Oct 2003 17:38:37 GMT
CSeq: 102 CANCEL
User-Agent: CSCO/4
Proxy-Authorization: Digest
username="7601",realm="asterisk",uri="sip:192.168.1.111",response="f35280ce287b45e2abdcb832d7244198",nonce="2a32fc8f",algorithm=md5
Content-Length: 0


10 headers, 0 lines
Sending to 192.168.1.13 : 5060 (non-NAT)
Transmitting (no NAT):
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.1.13:5060
From: "User ID"
<sip:7601 at 192.168.1.111>;tag=000b5f800a9b010359818116-229fbd39
To: <sip:17862862705 at 192.168.1.111>;tag=as2ae322ec
Call-ID: 000b5f80-0a9b0302-363288dd-7cacb51e at 192.168.1.13
CSeq: 102 CANCEL
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER
Contact: <sip:17862862705 at 192.168.1.111>
Content-Length: 0


 to 192.168.1.13:5060
Reliably Transmitting (no NAT):
SIP/2.0 487 Request Terminated
Via: SIP/2.0/UDP 192.168.1.13:5060
From: "User ID"
<sip:7601 at 192.168.1.111>;tag=000b5f800a9b010359818116-229fbd39
To: <sip:17862862705 at 192.168.1.111>;tag=as2ae322ec
Call-ID: 000b5f80-0a9b0302-363288dd-7cacb51e at 192.168.1.13
CSeq: 102 INVITE
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER
Contact: <sip:17862862705 at 192.168.1.111>
Content-Length: 0


 to 192.168.1.13:5060
DEBUG[311314]: File chan_sip.c, Line 1025 (sip_hangup): find_user(7601)
- decrement inUse counter
Sip read: 
ACK sip:17862862705 at 192.168.1.111 SIP/2.0
Via: SIP/2.0/UDP 192.168.1.13:5060
From: "User ID"
<sip:7601 at 192.168.1.111>;tag=000b5f800a9b010359818116-229fbd39
To: <sip:17862862705 at 192.168.1.111>;tag=as2ae322ec
Call-ID: 000b5f80-0a9b0302-363288dd-7cacb51e at 192.168.1.13
Date: Tue, 21 Oct 2003 17:38:37 GMT
CSeq: 102 ACK
Content-Length: 0







On Tue, 2003-10-21 at 12:39, Martin Pycko wrote:
> > [extensions.conf]
> > exten => 123456,1,SetVar,SIP_CODEC=ulaw
> > exten => 123456,2,Dial(${TRUNK}/${EXTEN})
> >
> > 	The problem is with the SetVar function, the debug shows that the
> > function is executed, but after that, * sends the media capability to
> > the phone with g729 as preferred codec.
> SIP_CODEC is was supposed to only change the codec of the incoming call,
> eg: asterisk responds with ANSWER with ulaw codec ...
> 
> But it won't change anything with the 2nd call.
> 
> regards
> Martin
> 
> _______________________________________________
> Asterisk-Users mailing list
> Asterisk-Users at lists.digium.com
> http://lists.digium.com/mailman/listinfo/asterisk-users
-- 
Luis Benavente <luisbe at bts-usa.com>




More information about the asterisk-users mailing list