Outbound Endpoint - no ARI events

I have an ARI client application and originate calls through an external provider. I defined an endpoint in pjsip.conf and an extension in the dialplan for that.

The call is initiated and the phone rings but I don’t receive any ARI Events in my event handler …

Worked in my local testing environment when I called a soft phone directly.

I guess it has something to do with the created bridges?

exten => My-Outbound,1,Verbose(2,Outbound call by caller ${CALLERID(name)} to callee ${CALLEE})
same => n,Verbose(EXTEN = ${EXTEN})
same => n,Dial(PJSIP/${CALLEE}@My-Outbound)
[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0
external_media_address=10.88.240.9
local_net=127.0.0.1/32

[MyAriApp-Outbound]
type=endpoint
aors=MyAriApp-Outbound
allow=g722,alaw
transport=transport-udp

[MyAriApp-Outbound]
type=aor
contact=sip:10.88.230.7:5060
Creating Stasis app 'MyAriApp'
  == WebSocket connection from '127.0.0.1:43614' for protocol '' accepted using version '13'
    -- Called MyAriApp-Outbound@MyAriApp
    -- Executing [MyAriApp-Outbound@MyAriApp:1] Verbose("Local/MyAriApp-Outbound@MyAriApp-00000001;2", "2,Outbound call) in new stack
  == Outbound call by caller  to callee 43111111111
    -- Executing [MyAriApp-Outbound@MyAriApp:2] Verbose("Local/MyAriApp-Outbound@MyAriApp-00000001;2", "EXTEN = MyAriApp-Outbound") in new stack
EXTEN = MyAriApp-Outbound
    -- Executing [MyAriApp-Outbound@MyAriApp:3] Dial("Local/MyAriApp-Outbound@MyAriApp-00000001;2", "PJSIP/+43111111111@MyAriApp-Outbound") in new stack
    -- Called PJSIP/+43111111111@MyAriApp-Outbound
       > 0x7f8e1c00ec20 -- Strict RTP learning after remote address set to: 10.88.240.9:11250
    -- PJSIP/MyAriApp-Outbound-00000001 is making progress passing it to Local/MyAriApp-Outbound@MyAriApp-00000001;2
    -- Local/MyAriApp-Outbound@MyAriApp-00000001;1 is making progress
       > 0x7f8e1c00ec20 -- Strict RTP switching to RTP target address 10.88.240.9:11250 as source
    -- PJSIP/MyAriApp-Outbound-00000001 answered Local/MyAriApp-Outbound@MyAriApp-00000001;2
    -- Local/MyAriApp-Outbound@MyAriApp-00000001;1 answered
       > Launching Stasis(MyAriApp) on Local/MyAriApp-Outbound@MyAriApp-00000001;1
    -- Channel PJSIP/MyAriApp-Outbound-00000001 joined 'simple_bridge' basic-bridge <f6a7ea4d-a768-4d66-a030-5d01cb2eb2c1>
    -- Channel Local/MyAriApp-Outbound@MyAriApp-00000001;2 joined 'simple_bridge' basic-bridge <f6a7ea4d-a768-4d66-a030-5d01cb2eb2c1>
       > 0x7f8e1c00ec20 -- Strict RTP learning complete - Locking on source address 10.88.240.9:11250
    -- Channel PJSIP/MyAriApp-Outbound-00000001 left 'simple_bridge' basic-bridge <f6a7ea4d-a768-4d66-a030-5d01cb2eb2c1>
    -- Channel Local/MyAriApp-Outbound@MyAriApp-00000001;2 left 'simple_bridge' basic-bridge <f6a7ea4d-a768-4d66-a030-5d01cb2eb2c1>
  == Spawn extension (MyAriApp, MyAriApp-Outbound, 3) exited non-zero on 'Local/MyAriApp-Outbound@MyAriApp-00000001;2'

Note that with ARI, you have to specify which Stasis “applications”† are associated with the events you are listening for. You specify this with the Stasis() application‡ in the dialplan.

Alternatively, your ARI event listener can specify the “subscribe-all” option, to listen for all events.

†Bad choice of term, don’t you think so, considering that those commands you use in dialplans are also called “applications”.
‡See what I mean.

I can see Asterisk is sending ARI events to my app, but they never arrive …

<--- Sending ARI event to 192.168.240.1:51822 --->
{
  "type": "Dial",
  "timestamp": "2023-01-12T14:07:01.831+0100",
  "dialstatus": "RINGING",
  "forward": "",
  "dialstring": "44448888",
  "peer": {
    "id": "CHID-dc7c3e52-7810-4675-a51b-16ac3d577cc2",
    "name": "PJSIP/44448888-0000000d",
    "state": "Ringing",
    "caller": {
      "name": "IVR",
      "number": "44448888"
    },
    "connected": {
      "name": "IVR",
      "number": ""
    },
    "accountcode": "",
    "dialplan": {
      "context": "myContext",
      "exten": "s",
      "priority": 1,
      "app_name": "AppDial2",
      "app_data": "(Outgoing Line)"
    },
    "creationtime": "2023-01-12T14:07:01.826+0100",
    "language": "en"
  },
  "asterisk_id": "00:0c:29:3b:58:77",
  "application": "myContext"
}

Was an application internal problem … a databinding dependency.