# Custom Extension

**URL:** <https://community.asterisk.org/t/custom-extension/38959>\
**Category:** Asterisk Support\
**Created:** [April 19, 2012, 11:36am UTC](https://community.asterisk.org/t/custom-extension/38959 "2012-04-19T11:36:20Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/asterisk/original/2X/4/475d0c889911cfb84ac4881ad6df8b523e3f9105.png) [@system](https://community.asterisk.org/u/system)\
**Post date:** [April 19, 2012, 11:36am UTC](https://community.asterisk.org/t/custom-extension/38959/1 "2012-04-19T11:36:20Z")

</div>

Hi! I’m very new to Asterisk. I’m just learning it. I have asterisk and FreePBX installed. I want to learn how to create custom extensions. I have created custom extension that answers a call, says your number and then i want it to dial another number (say 1111).  
I have written these lines in extension\_override\_freepbx.conf:

```auto
[from-internal-additional]
exten => 1114,1,Answer()
exten => 1114,n,Playback(cdir-welcome)
exten => 1114,n,SayDigits(${CALLERID(number)})
exten => 1114,n,Dial(SIP/1111)
exten => 1114,n,Hangup()
```

So, it answers, plays “welcome”, says my number but doesn’t dial number 1111  
Then I write:

```auto

```

Now, if I dial 1114, listen to the voice and then enter 1111 - this works. But I want this: exten =\> 1114,n,Dial(SIP/1111)  
Please tell me what am I doing wrong? Why this line exten =\> 1114,n,Dial(SIP/1111) doesn’t work?  
p.s. sorry for my english 😄

---

<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:** [April 19, 2012, 11:55am UTC](https://community.asterisk.org/t/custom-extension/38959/2 "2012-04-19T11:55:08Z")

</div>

Verbose logs?

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/asterisk/original/2X/4/475d0c889911cfb84ac4881ad6df8b523e3f9105.png) [@system](https://community.asterisk.org/u/system)\
**Post date:** [April 19, 2012, 12:06pm UTC](https://community.asterisk.org/t/custom-extension/38959/3 "2012-04-19T12:06:18Z")

</div>

“”,“1112”,“1114”,“from-internal”,""“xxx”" \<1112\>",“SIP/1112-00000003”,"",“Hangup”,"",“2012-04-19 12:00:42”,“2012-04-19 12:00:42”,“2012-04-19 12:00:45”,3,3,“ANSWERED”,“DOCUMENTATION”,“1334836842.3”,""

---

<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:** [April 19, 2012, 12:07pm UTC](https://community.asterisk.org/t/custom-extension/38959/4 "2012-04-19T12:07:43Z")

</div>

That’s a call detail record.

Connect to the CLI and issue “core set verbose 3” (you can use a higher number.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/asterisk/original/2X/4/475d0c889911cfb84ac4881ad6df8b523e3f9105.png) [@system](https://community.asterisk.org/u/system)\
**Post date:** [April 19, 2012, 12:11pm UTC](https://community.asterisk.org/t/custom-extension/38959/5 "2012-04-19T12:11:17Z")

</div>

tail messages  
[2012-04-19 14:54:43] WARNING[6922] pbx.c: Context ‘from-internal-xfer’ tries to include nonexistent context ‘from-internal-custom’  
[2012-04-19 14:54:43] WARNING[6922] pbx.c: Context ‘from-did-direct’ tries to include nonexistent context ‘ext-findmefollow’  
[2012-04-19 14:54:43] NOTICE[6922] pbx\_ael.c: AEL load process: verified config file name ‘/etc/asterisk/extensions.ael’.  
[2012-04-19 14:54:53] NOTICE[6936] chan\_sip.c: Peer ‘1112’ is now Reachable. (15ms / 2000ms)  
[2012-04-19 14:55:00] WARNING[7015] app\_dial.c: Unable to create channel of type ‘SIP’ (cause 20 - Unknown)  
[2012-04-19 14:58:29] WARNING[7105] app\_dial.c: Unable to create channel of type ‘SIP’ (cause 20 - Unknown)  
[2012-04-19 15:00:45] WARNING[7120] app\_dial.c: Unable to create channel of type ‘SIP’ (cause 20 - Unknown)  
[2012-04-19 15:02:29] WARNING[7130] app\_dial.c: Unable to create channel of type ‘SIP’ (cause 20 - Unknown)  
[2012-04-19 15:04:39] WARNING[7141] app\_dial.c: Unable to create channel of type ‘SIP’ (cause 20 - Unknown)  
[2012-04-19 15:05:43] WARNING[7155] app\_dial.c: Unable to create channel of type ‘SIP’ (cause 20 - Unknown)

---

<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:** [April 19, 2012, 12:20pm UTC](https://community.asterisk.org/t/custom-extension/38959/6 "2012-04-19T12:20:38Z")

</div>

That is not verbosity 3. However, the next question is what is the result of:

sip show peer 1111

and, if that says not found, what is the part of sip or users.conf that purports to define that device?

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/asterisk/original/2X/4/475d0c889911cfb84ac4881ad6df8b523e3f9105.png) [@system](https://community.asterisk.org/u/system)\
**Post date:** [April 19, 2012, 12:22pm UTC](https://community.asterisk.org/t/custom-extension/38959/7 "2012-04-19T12:22:38Z")

</div>

I think you wanted me to show this 😄

`
Connected to Asterisk 1.8.11.0 currently running on kubuntu (pid = 7527)
Verbosity is at least 3
  == Using SIP RTP TOS bits 184
  == Using SIP RTP CoS mark 5
    -- Executing [1114@from-internal:1] Answer("SIP/1112-00000000", "") in new stack
    -- Executing [1114@from-internal:2] Playback("SIP/1112-00000000", "cdir-welcome") in new stack
    -- <SIP/1112-00000000> Playing 'cdir-welcome.slin' (language 'en')
    -- Executing [1114@from-internal:3] SayDigits("SIP/1112-00000000", "1114") in new stack
    -- <SIP/1112-00000000> Playing 'digits/1.gsm' (language 'en')
    -- <SIP/1112-00000000> Playing 'digits/1.gsm' (language 'en')
    -- <SIP/1112-00000000> Playing 'digits/1.gsm' (language 'en')
    -- <SIP/1112-00000000> Playing 'digits/4.gsm' (language 'en')
    -- Executing [1114@from-internal:4] SayDigits("SIP/1112-00000000", "1112") in new stack
    -- <SIP/1112-00000000> Playing 'digits/1.gsm' (language 'en')
    -- <SIP/1112-00000000> Playing 'digits/1.gsm' (language 'en')
    -- <SIP/1112-00000000> Playing 'digits/1.gsm' (language 'en')
    -- <SIP/1112-00000000> Playing 'digits/2.gsm' (language 'en')
    -- Executing [1114@from-internal:5] Dial("SIP/1112-00000000", "SIP/1111") in new stack
[2012-04-19 15:16:31] WARNING[7623]: app_dial.c:2218 dial_exec_full: Unable to create channel of type 'SIP' (cause 20 - Unknown)
  == Everyone is busy/congested at this time (1:0/0/1)
    -- Executing [1114@from-internal:6] Hangup("SIP/1112-00000000", "") in new stack
  == Spawn extension (from-internal, 1114, 6) exited non-zero on 'SIP/1112-00000000'
    -- Executing [h@from-internal:1] Hangup("SIP/1112-00000000", "") in new stack
  == Spawn extension (from-internal, h, 1) exited non-zero on 'SIP/1112-00000000'`

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/asterisk/original/2X/4/475d0c889911cfb84ac4881ad6df8b523e3f9105.png) [@system](https://community.asterisk.org/u/system)\
**Post date:** [April 19, 2012, 12:24pm UTC](https://community.asterisk.org/t/custom-extension/38959/8 "2012-04-19T12:24:10Z")

</div>

sip show peer 1111

` * Name : 1111
  Secret : <Set>
  MD5Secret : <Not set>
  Remote Secret: <Not set>
  Context : from-internal
  Subscr.Cont. : <Not set>
  Language : 
  AMA flags : Unknown
  Transfer mode: open
  CallingPres : Presentation Allowed, Not Screened
  Callgroup : 
  Pickupgroup : 
  MOH Suggest : 
  Mailbox : 1111@default
  VM Extension : *97
  LastMsgsSent : 32767/65535
  Call limit : 2147483647
  Max forwards : 0
  Dynamic : Yes
  Callerid : "Bogdan" <1111>
  MaxCallBR : 384 kbps
  Expire : -1
  Insecure : no
  Force rport : No
  ACL : Yes
  DirectMedACL : No
  T.38 support : No
  T.38 EC mode : Unknown
  T.38 MaxDtgrm: -1
  DirectMedia : No
  PromiscRedir : No
  User=Phone : No
  Video Support: No
  Text Support : No
  Ign SDP ver : No
  Trust RPID : Yes
  Send RPID : No
  Subscriptions: Yes
  Overlap dial : Yes
  DTMFmode : rfc2833
  Timer T1 : 500
  Timer B : 32000
  ToHost : 
  Addr->IP : (null)
  Defaddr->IP : (null)
  Prim.Transp. : UDP
  Allowed.Trsp : UDP
  Def. Username: 
  SIP Options : (none)
  Codecs : 0xc (ulaw|alaw)
  Codec Order : (ulaw:20,alaw:20)
  Auto-Framing : No 
  Status : UNKNOWN
  Useragent : 
  Reg. Contact : 
  Qualify Freq : 60000 ms
  Sess-Timers : Accept
  Sess-Refresh : uas
  Sess-Expires : 1800 secs
  Min-Sess : 90 secs
  RTP Engine : asterisk
  Parkinglot : 
  Use Reason : No
  Encryption : No`

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/asterisk/original/2X/4/475d0c889911cfb84ac4881ad6df8b523e3f9105.png) [@system](https://community.asterisk.org/u/system)\
**Post date:** [April 19, 2012, 12:38pm UTC](https://community.asterisk.org/t/custom-extension/38959/9 "2012-04-19T12:38:54Z")

</div>

Actually peer 1111 is not connected. I have only 1 working phone (1112). When I dial 1111 directly I hear voice saying “Number is unavailable…”. And that’s enough for me. But I want to make it work this way: when I dial 1114 system says my number and then dials number 1111 for me. I need this only for understanding how it works:)

---

<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:** [April 19, 2012, 12:45pm UTC](https://community.asterisk.org/t/custom-extension/38959/10 "2012-04-19T12:45:04Z")

</div>

You should use GoTo (to the context, extension, 1) rather than Dial (or you could Dial it as a local channel.

FreePBX confuses devices and extensions. You have specified a device, when you meant to specify an extension.

This confusion make it eaiser for an attacker to search for weak passwords.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/asterisk/original/2X/4/475d0c889911cfb84ac4881ad6df8b523e3f9105.png) [@system](https://community.asterisk.org/u/system)\
**Post date:** [April 19, 2012, 12:57pm UTC](https://community.asterisk.org/t/custom-extension/38959/11 "2012-04-19T12:57:16Z")

</div>

David, thank you very much for your help!
