Dial plan called twice

Why does this configuration (stripped down to a mininal example) trigger the call twice?

Dialplan:

[fax_caller]
exten => faxout,1,NoOp(** Fax caller **)
same => n,Dial(PJSIP/mysipprovider/sip:${ReceiverPhoneNr}@mysipprovider.com:5084)

Callfile:

Channel:Local/faxout@fax_caller
MaxRetries:1
WaitTime:45
Context:fax_caller
Extension:faxout
Priority:1
Setvar:CustomerPhoneNr=SENDERPHONENR
Setvar:ReceiverPhoneNr=RECEIVERPHONENR

This is the Asterisk log when moving the callfile into the spool directory:

    -- Attempting call on Local/faxout@fax_caller for faxout@fax_caller:1 (Retry 1)
    -- Called faxout@fax_caller
    -- Executing [faxout@fax_caller:1] NoOp("Local/faxout@fax_caller-00000000;2", "** Fax caller **") in new stack
    -- Executing [faxout@fax_caller:2] Dial("Local/faxout@fax_caller-00000000;2", "PJSIP/mysipprovider/sip:+RECEIVERPHONENR@mysipprovider.com:5084") in new stack
    -- Called PJSIP/mysipprovider/sip:+RECEIVERPHONENR@mysipprovider.com:5084
    -- PJSIP/mysipprovider-00000000 is ringing
    -- Local/faxout@fax_caller-00000000;1 is ringing
    -- PJSIP/mysipprovider-00000000 is ringing
    -- PJSIP/mysipprovider-00000000 answered Local/faxout@fax_caller-00000000;2
       > 0x7fb35c027230 -- Strict RTP learning after remote address set to: 193.84.65.208:12044
    -- Local/faxout@fax_caller-00000000;1 answered
    -- Executing [faxout@fax_caller:1] NoOp("Local/faxout@fax_caller-00000000;1", "** Fax caller **") in new stack
    -- Executing [faxout@fax_caller:2] Dial("Local/faxout@fax_caller-00000000;1", "PJSIP/mysipprovider/sip:+RECEIVERPHONENR@mysipprovider.com:5084") in new stack
    -- Channel PJSIP/mysipprovider-00000000 joined 'simple_bridge' basic-bridge <91b5bc20-9731-4ce0-a93f-271a0b5dfb4b>
    -- Channel Local/faxout@fax_caller-00000000;2 joined 'simple_bridge' basic-bridge <91b5bc20-9731-4ce0-a93f-271a0b5dfb4b>
    -- Called PJSIP/mysipprovider/sip:+RECEIVERPHONENR@mysipprovider.com:5084
    -- Local/faxout@fax_caller-00000000;1 requested media update control 26, passing it to PJSIP/mysipprovider-00000001
  == Everyone is busy/congested at this time (1:1/0/0)
    -- Auto fallthrough, channel 'Local/faxout@fax_caller-00000000;1' status is 'BUSY'
       > 0x7fb35c027230 -- Strict RTP switching to RTP target address 193.84.65.208:12044 as source
       > 0x7fb35c027230 -- Strict RTP learning complete - Locking on source address 193.84.65.208:12044
[Sep 26 11:48:35] NOTICE[27214][C-00000002]: pbx_spool.c:463 attempt_thread: Call completed to Local/faxout@fax_caller
    -- Channel Local/faxout@fax_caller-00000000;2 left 'simple_bridge' basic-bridge <91b5bc20-9731-4ce0-a93f-271a0b5dfb4b>
    -- Channel PJSIP/mysipprovider-00000000 left 'simple_bridge' basic-bridge <91b5bc20-9731-4ce0-a93f-271a0b5dfb4b>
  == Spawn extension (fax_caller, faxout, 2) exited non-zero on 'Local/faxout@fax_caller-00000000;2'

Your call file is written to call the “faxout” extension in the “fax_caller” context. Once answered it is then directed to the “faxout” extension in the “fax_caller” context. You are sending each side of the Local channel to the same place, and thus you get it twice.

1 Like

@jcolp Thank you. Until now, I used Asterisk, now I begin understanding it…

Modified Callfile to:

Extension:faxsend

Modified dialplan to:

exten => faxout,1,NoOp(** Fax caller **)
same => n,Dial(PJSIP/mysipprovider/sip:${ReceiverPhoneNr}@mysipprovider.com:5084,,b(fax_outgoing_init^faxout^1(${CustomerPhoneNr})))
exten => faxsend,1,NoOp(** Sending fax **)
same => n,SendFAX(/var/spool/asterisk/fax/${TIFF_FILE},dfs)

Now, it works. Great, thanks!

1 Like

I also have the same issue. Calls originate twice. this is the log which I am getting

== Manager ‘varuni’ logged on from 192.168.0.130
– Called 9981931117@csr
– Executing [9981931117@csr:1] GotoIf(“Local/9981931117@csr-0000003c;2”, “1?dialmanual:dialauto”) in new stack
– Goto (csr,9981931117,2)
– Executing [9981931117@csr:2] Dial(“Local/9981931117@csr-0000003c;2”, “SIP/09981931117@agro,tTo”) in new stack
== Using SIP RTP CoS mark 5
– Called SIP/09981931117@agro
== Manager ‘mayur’ logged off from 192.168.0.130
> 0x7fb74800aa30 – Strict RTP learning after remote address set to: 192.168.0.250:11842
– SIP/agro-0000004f is making progress passing it to Local/9981931117@csr-0000003c;2
– Local/9981931117@csr-0000003c;1 is making progress
> 0x7fb74800aa30 – Strict RTP switching to RTP target address 192.168.0.250:11842 as source
– SIP/agro-0000004f is ringing
– Local/9981931117@csr-0000003c;1 is ringing
> 0x7fb74800aa30 – Strict RTP learning complete - Locking on source address 192.168.0.250:11842
– SIP/agro-0000004f redirecting info has changed, passing it to Local/9981931117@csr-0000003c;2
– SIP/agro-0000004f is busy
== Everyone is busy/congested at this time (1:1/0/0)
– Executing [9981931117@csr:3] Queue(“Local/9981931117@csr-0000003c;2”, “csrteam,60”) in new stack
– Started music on hold, class ‘default’, on channel ‘Local/9981931117@csr-0000003c;2’
== Using SIP RTP CoS mark 5
– Called SIP/1001
– SIP/1001-00000050 is ringing
– Stopped music on hold on Local/9981931117@csr-0000003c;2
== Spawn extension (csr, 9981931117, 3) exited non-zero on ‘Local/9981931117@csr-0000003c;2’