# S extension: Inbound call handling

**URL:** <https://community.asterisk.org/t/s-extension-inbound-call-handling/36705>\
**Category:** Asterisk Support\
**Created:** [September 16, 2011, 7:23pm UTC](https://community.asterisk.org/t/s-extension-inbound-call-handling/36705 "2011-09-16T19:23:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![gatorback](https://avatars.discourse-cdn.com/v4/letter/g/74df32/32.png) [@gatorback](https://community.asterisk.org/u/gatorback)\
**Post date:** [September 16, 2011, 7:23pm UTC](https://community.asterisk.org/t/s-extension-inbound-call-handling/36705/1 "2011-09-16T19:23:06Z")

</div>

I am forced to use this in my dialplan:

[from-callcentric]  
exten =\> 1777XXXXXXX,1,Dial(SIP/101,10)

The ‘s’ extension does not work in this context:  
[from-callcentric]  
exten =\> s,1,Dial(SIP/101,10)

The ‘s’ extension does work in this context:  
[google-in]  
exten =\> s, 1, Dial(SIP/101, 180, D(:1))

Did I misunderstand how to apply the S-extension? Thanks.

---

<div class="post-metadata">

**Author:** ![david55](https://avatars.discourse-cdn.com/v4/letter/d/e19adc/32.png) [@david55](https://community.asterisk.org/u/david55)\
**Post date:** [September 16, 2011, 8:50pm UTC](https://community.asterisk.org/t/s-extension-inbound-call-handling/36705/2 "2011-09-16T20:50:09Z")

</div>

Use the actual number for true Direct in DIaling.

Use s when the service doesn’t tell you the dialled number.

Single number DID (which is called DID in Asterisk circles, but isn’t really) will also need the actual number matching.

Basically, if the invite says:

INVITE

use s

if it says

INVITE @

match the possible numbers.

---

<div class="post-metadata">

**Author:** ![ambiorixg12](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/ambiorixg12/32/1887_2.png) [@ambiorixg12](https://community.asterisk.org/u/ambiorixg12)\
**Post date:** [September 17, 2011, 7:18am UTC](https://community.asterisk.org/t/s-extension-inbound-call-handling/36705/3 "2011-09-17T07:18:31Z")

</div>

it is strange i use gtalk and callcentric and the s extensions work fine , but let see the output of your CLI when you use the extension in an incomming call context…

---

<div class="post-metadata">

**Author:** ![gatorback](https://avatars.discourse-cdn.com/v4/letter/g/74df32/32.png) [@gatorback](https://community.asterisk.org/u/gatorback)\
**Post date:** [September 22, 2011, 12:32am UTC](https://community.asterisk.org/t/s-extension-inbound-call-handling/36705/4 "2011-09-22T00:32:52Z")

</div>

I wonder if this problem is specific to my combination of hardware and software version.

For your viewing pleasure: I turned sip debugging on:

[code]\<— SIP read from UDP:204.11.192.31:5060 —\>  
INVITE sip:1777XXXYYYY@98.82.XX.YY:5060 SIP/2.0  
v: SIP/2.0/UDP 204.11.192.31:5060;branch=z9hG4bK-9eaf37fa80828701369b813b8afbcbf2  
f: “firstname lastname” \<sip:my [number@callcentric.com](mailto:number@callcentric.com)\>;tag=493e745c442bd52co0  
t: sip:1777XXXYYYY@callcentric.com  
i: [6c6a881c-17e8d46c@192.168.8.110](mailto:6c6a881c-17e8d46c@192.168.8.110)  
CSeq: 102 INVITE  
Max-Forwards: 13  
m: sip:bf4f0eae213a4a04da25854f5fe8e6e5@204.11.192.31:5060;transport=udp  
Supported: x-sipura, replaces  
Allow: ACK, BYE, CANCEL, INFO, INVITE, NOTIFY, OPTIONS, REFER  
Expires: 240  
c: application/sdp  
l: 488

v=0  
o=17772022880 1 1 IN IP4 204.11.192.31  
s=-  
c=IN IP4 204.11.192.31  
t=0 0  
m=audio 55374 RTP/AVP 18 0 2 4 8 96 97 98 100 101  
a=rtpmap:18 G729a/8000  
a=rtpmap:0 PCMU/8000  
a=rtpmap:2 G726-32/8000  
a=rtpmap:4 G723/8000  
a=rtpmap:8 PCMA/8000  
a=rtpmap:96 G726-40/8000  
a=rtpmap:97 G726-24/8000  
a=rtpmap:98 G726-16/8000  
a=rtpmap:100 NSE/8000  
a=fmtp:100 192-193  
a=rtpmap:101 telephone-event/8000  
a=fmtp:101 0-15  
a=ptime:30  
a=sendrecv  
a=silenceSupp:off - - - -  
a=setup:actpass  
\<-------------\>  
— (13 headers 22 lines) —  
Sending to 204.11.192.31:5060 (no NAT)  
Using INVITE request as basis request - [6c6a881c-17e8d46c@192.168.8.110](mailto:6c6a881c-17e8d46c@192.168.8.110)  
No matching peer for ‘my number’ from '204.11.192.31:5060’  
Found RTP audio format 18  
Found RTP audio format 0  
Found RTP audio format 2  
Found RTP audio format 4  
Found RTP audio format 8  
Found RTP audio format 96  
Found RTP audio format 97  
Found RTP audio format 98  
Found RTP audio format 100  
Found RTP audio format 101  
Found audio description format G729a for ID 18  
Found audio description format PCMU for ID 0  
Found audio description format G726-32 for ID 2  
Found audio description format G723 for ID 4  
Found audio description format PCMA for ID 8  
Found audio description format G726-40 for ID 96  
Found audio description format G726-24 for ID 97  
Found audio description format G726-16 for ID 98  
Found audio description format NSE for ID 100  
Found audio description format telephone-event for ID 101  
Capabilities: us - 0x80000008000e (gsm|ulaw|alaw|h263|testlaw), peer - audio=0x100d0d (g723|ulaw|alaw|g726|g729|ilbc|h263p)/video=0x0 (nothing)/text=0x0 (nothing), combined - 0xc (ulaw|alaw)  
Non-codec capabilities (dtmf): us - 0x1 (telephone-event|), peer - 0x1 (telephone-event|), combined - 0x1 (telephone-event|)  
Peer audio RTP is at port 204.11.192.31:55374  
Looking for 1777XXXYYYY in from-callcentric (domain 98.82.XX.YY:5060)

\<— Reliably Transmitting (no NAT) to 204.11.192.31:5060 —\>  
SIP/2.0 404 Not Found  
Via: SIP/2.0/UDP 204.11.192.31:5060;branch=z9hG4bK-9eaf37fa80828701369b813b8afbcbf2;received=204.11.192.31  
From: “firstname lastname” \<sip:my [number@callcentric.com](mailto:number@callcentric.com)\>;tag=493e745c442bd52co0  
To: sip:1777XXXYYYY@callcentric.com;tag=as5f065b8c  
Call-ID: [6c6a881c-17e8d46c@192.168.8.110](mailto:6c6a881c-17e8d46c@192.168.8.110)  
CSeq: 102 INVITE  
Server: Asterisk PBX 1.8.4  
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH  
Supported: replaces  
Content-Length: 0

\<------------\>  
[Sep 21 20:17:28] NOTICE[3919]: chan\_sip.c:21581 handle\_request\_invite: Call from ‘’ to extension ‘1777XXXYYYY’ rejected because extension not found in context ‘from-callcentric’.  
Scheduling destruction of SIP dialog ‘6c6a881c-17e8d46c@192.168.8.110’ in 32000 ms (Method: INVITE)

\<— SIP read from UDP:204.11.192.31:5060 —\>  
ACK sip:1777XXXYYYY@98.82.XX.YY:5060 SIP/2.0  
v: SIP/2.0/UDP 204.11.192.31:5060;branch=z9hG4bK-9eaf37fa80828701369b813b8afbcbf2  
f: “firstname lastname” \<sip:my [number@callcentric.com](mailto:number@callcentric.com)\>;tag=493e745c442bd52co0  
t: sip:1777XXXYYYY@callcentric.com;tag=as5f065b8c  
i: [6c6a881c-17e8d46c@192.168.8.110](mailto:6c6a881c-17e8d46c@192.168.8.110)  
CSeq: 102 ACK  
Max-Forwards: 15  
l: 0

\<-------------\>  
— (8 headers 0 lines) —  
Really destroying SIP dialog ‘6c6a881c-17e8d46c@192.168.8.110’ Method: ACK  
Really destroying SIP dialog ‘7f6d8f1d1f40dc3178696d582fb731df@[c0a8:801:789b:a97f::]’ Method: REGISTER[/code]

---

<div class="post-metadata">

**Author:** ![dejanst](https://avatars.discourse-cdn.com/v4/letter/d/9fc348/32.png) [@dejanst](https://community.asterisk.org/u/dejanst)\
**Post date:** [September 22, 2011, 5:28pm UTC](https://community.asterisk.org/t/s-extension-inbound-call-handling/36705/5 "2011-09-22T17:28:53Z")

</div>

It looks like Asterisk does not find extension 1777XXXYYYY in the context.

Please also publish the content of sip.conf and extensions.conf. We need more information.

---

<div class="post-metadata">

**Author:** ![gatorback](https://avatars.discourse-cdn.com/v4/letter/g/74df32/32.png) [@gatorback](https://community.asterisk.org/u/gatorback)\
**Post date:** [September 22, 2011, 6:37pm UTC](https://community.asterisk.org/t/s-extension-inbound-call-handling/36705/6 "2011-09-22T18:37:21Z")

</div>

@dejanst: Thanks for looking at this question. In the original posting, changing the dialplan statement to:

```auto

```

fixed the problem. I have been using the S extension to handle my inbound Google Voice / Jabber calls. Not sure why it works with GV and not with a SIP provider.

Here is an excerpt from my sip.conf:

[code][general]  
alwaysauthreject=yes  
; 9/6/11  
; [ABC] [http://www.callcentric.com/support/device/asterisk/1\_6](http://www.callcentric.com/support/device/asterisk/1_6)  
dtmfmode = rfc2833  
context=from-callcentric  
srvlookup=yes  
register =\> [1777XXXYYYY:myPassword1@callcentric.com](mailto:1777XXXYYYY:myPassword1@callcentric.com)/1777XXXYYYY  
session-timers=refuse  
session-expires=180  
session-minse=90  
session-refresher=uas  
; [http://www.callcentric.com/support/device/asterisk/1\_6](http://www.callcentric.com/support/device/asterisk/1_6)

[callcentric]  
; 9/9/11: attempt to restrict codec  
type=peer  
context=from-callcentric ;how incoming calls are handle: defined in: extensions.conf  
[host=callcentric.com](http://host=callcentric.com)  
defaultuser=1777XXXYYYY ;account=XXXXXXXX, pw=YYYYYYH  
secret=myPassword1  
fromuser=1777XXXYYYY  
[fromdomain=callcentric.com](http://fromdomain=callcentric.com)  
insecure=invite ;9/6/11  
disallow=all  
allow=g729

[101]  
; [ABC] [http://supermario-world.blogspot.com/2010/11/asterisk-18-and-native-google-voice.html](http://supermario-world.blogspot.com/2010/11/asterisk-18-and-native-google-voice.html)  
type=friend  
host=dynamic  
nat=yes  
qualify=yes  
; context=to-callcentric TEST ONLY, uncomment next line  
context=mario-default ; found in exentsions.conf  
defaultuser=101  
secret=myPassword1  
callerid=“SPA2102\_L2” \<101\>  
mailbox=101  
; [ABC] [http://supermario-world.blogspot.com/2010/11/asterisk-18-and-native-google-voice.html[/code]](http://supermario-world.blogspot.com/2010/11/asterisk-18-and-native-google-voice.html%5B/code%5D)
