Dynamic Route issue

Hey everyone - anyone who can help?

So, I have this page where it outputs some data we want to have playback to the caller (to update them on their order status)

1. https://friendlystranger.gr/check_order.php?order_number=1184

2. We then setup a Dynamic route in FreePBX:

3. Added a Custom Destination:

image

4. And finally added this in the “extensions_custom.conf” file:

[read-order-status]
exten => s,1,NoOp(Processing Order Status)
exten => s,n,Set(order_details=${dynroute})

; Extract the information
exten => s,n,Set(status=${CUT(CUT(order_details,|,1),:,2)})
exten => s,n,Set(courier=${CUT(CUT(order_details,|,2),:,2)})
exten => s,n,Set(tracking=${CUT(CUT(order_details,|,3),:,2)})

; Log the extracted details for debugging
exten => s,n,NoOp(Status: ${status}, Courier: ${courier}, Tracking: ${tracking})

; Playback the details
exten => s,n,Playback(your-order-status-is) 
exten => s,n,SayAlpha(${status})

exten => s,n,Playback(your-courier-is) 
exten => s,n,SayAlpha(${courier})

exten => s,n,Playback(your-tracking-number-is) 
exten => s,n,SayDigits(${tracking})

exten => s,n,Hangup()

However, although it’s pulling the data, its just going into a blackhole:

107097	[2024-09-01 00:58:17] VERBOSE[21117][C-00000137] app_read.c: Accepting a maximum of 4 digits.	
107098	[2024-09-01 00:58:17] VERBOSE[21117][C-00000137] file.c: <PJSIP/anonymous-0000027e> Playing 'custom/Call_originating_from_other_store.slin' (language 'gr')	
107099	[2024-09-01 00:58:24] VERBOSE[21117][C-00000137] app_read.c: User entered '1184'	
107100	[2024-09-01 00:58:24] VERBOSE[21117][C-00000137] pbx.c: Executing [s@dynroute-1:3] Set("PJSIP/anonymous-0000027e", "dynroute=") in new stack	
107101	[2024-09-01 00:58:24] VERBOSE[21117][C-00000137] pbx.c: Executing [s@dynroute-1:4] Set("PJSIP/anonymous-0000027e", "CURLOPT(dnstimeout)=5") in new stack	
107102	[2024-09-01 00:58:24] VERBOSE[21117][C-00000137] pbx.c: Executing [s@dynroute-1:5] Set("PJSIP/anonymous-0000027e", "CURLOPT(conntimeout)=5") in new stack	
107103	[2024-09-01 00:58:24] VERBOSE[21117][C-00000137] pbx.c: Executing [s@dynroute-1:6] Set("PJSIP/anonymous-0000027e", "CURLOPT(ftptimeout)=5") in new stack	
107104	[2024-09-01 00:58:24] VERBOSE[21117][C-00000137] pbx.c: Executing [s@dynroute-1:7] Set("PJSIP/anonymous-0000027e", "CURLOPT(httptimeout)=5") in new stack	
107105	[2024-09-01 00:58:24] VERBOSE[21117][C-00000137] pbx.c: Executing [s@dynroute-1:8] Set("PJSIP/anonymous-0000027e", "dynroute=status:wc-failed|courier:ACS|tracking:2548778541") in new stack	
107106	[2024-09-01 00:58:24] VERBOSE[21117][C-00000137] pbx.c: Executing [s@dynroute-1:9] Set("PJSIP/anonymous-0000027e", "dynroute=status:wc-failed|courier:ACS|tracking:2548778541") in new stack	
107107	[2024-09-01 00:58:24] VERBOSE[21117][C-00000137] pbx.c: Executing [s@dynroute-1:10] GotoIf("PJSIP/anonymous-0000027e", "0?dynroute-1,1,1") in new stack	
107108	[2024-09-01 00:58:24] VERBOSE[21117][C-00000137] pbx.c: Executing [s@dynroute-1:11] GotoIf("PJSIP/anonymous-0000027e", "0?read-order-status,s,1") in new stack	
107109	[2024-09-01 00:58:24] VERBOSE[21117][C-00000137] pbx.c: Executing [s@dynroute-1:12] Goto("PJSIP/anonymous-0000027e", "dynroute-1,1,1") in new stack	
107110	[2024-09-01 00:58:24] VERBOSE[21117][C-00000137] pbx_builtins.c: Goto (dynroute-1,1,1)	
107111	[2024-09-01 00:58:24] VERBOSE[21117][C-00000137] pbx.c: Executing [1@dynroute-1:1] Goto("PJSIP/anonymous-0000027e", "app-blackhole,busy,1") in new stack	
107112	[2024-09-01 00:58:24] VERBOSE[21117][C-00000137] pbx_builtins.c: Goto (app-blackhole,busy,1)	
107113	[2024-09-01 00:58:24] VERBOSE[21117][C-00000137] pbx.c: Executing [busy@app-blackhole:1] NoOp("PJSIP/anonymous-0000027e", "Blackhole Dest: Busy") in new stack	
107114	[2024-09-01 00:58:24] VERBOSE[21117][C-00000137] pbx.c: Executing [busy@app-blackhole:2] Progress("PJSIP/anonymous-0000027e", "") in new stack	
107115	[2024-09-01 00:58:24] VERBOSE[21117][C-00000137] pbx.c: Executing [busy@app-blackhole:3] Busy("PJSIP/anonymous-0000027e", "20") in new stack	
107116	[2024-09-01 00:58:27] VERBOSE[21117][C-00000137] pbx.c: Spawn extension (app-blackhole, busy, 3) exited non-zero on 'PJSIP/anonymous-0000027e'	
107117	[2024-09-01 00:58:27] VERBOSE[21118][C-00000137] app_mixmonitor.c: MixMonitor close filestream (mixed)	
107118	[2024-09-01 00:58:27] VERBOSE[21118][C-00000137] app_mixmonitor.c: End MixMonitor Recording PJSIP/anonymous-0000027e

A few thoughts

  1. The URL specified will only be called with the caller ID number if you have “Enable Substitutions” set to yes. Read the tooltip for this field.
  2. Presumably the URL will return a string in plain text (that’s what dynroutes expects) and whatever that string returns must match exactly what you put in the Match field at the bottom. You can’t use a variable there. Based on what I can see here, you don’t want to branch the call, you want to always send the call on to the default destination.
  3. Note the field in the dynroute page named “Saved result variable name”, it’s preferred to populate that field so that the lookup result of the URL is assigned to a channel variable so it can be referenced later in the call flow. ${dynroute} can be overwritten. Note the tooltip here as well, if you have a saved result variable name of check_order, then you would reference that later as DYNROUTE_check_order

This worked mate: 1. The URL specified will only be called with the caller ID number if you have “Enable Substitutions” set to yes. Read the tooltip for this field.

I’m clearly blind and didn’t see it through correctly when configuring it.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.