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