Custom Extension

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:

[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:

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 :smile:

Verbose logs?

“”,“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”,""

That’s a call detail record.

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

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)

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?

I think you wanted me to show this :smile:

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'

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

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:)

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.

David, thank you very much for your help!