Setting up FreePBX to send a X-Tenant SIP header for Skyetel Tenant tracking
-
I used
ExecIf
for the outbound route logic because usingGotoIf
would be more lines of code getting written. ButGotoIf
would actually process fewer lines of code if you have more ExecIf than a few. It was a conscious decision/trade off.This is the logic for
GotoIf
instead.; Change it if the call is on a Cape, Jeff City, or Quincy outbound route. exten => s,n,GotoIf($["${OUTBOUND_ROUTE_NAME:0:4}"=="Cape"]?tenant_cape) exten => s,n,GotoIf($["${OUTBOUND_ROUTE_NAME:0:9}"=="Jeff City"]?tenant_jeffcity) exten => s,n,GotoIf($["${OUTBOUND_ROUTE_NAME:0:6}"=="Quincy"]?tenant_quincy)) ; Nothing match goto set_tenant exten => s,n,Goto(set_tenant) exten => s,n(tenant_cape),Set(x_tenant=tenant.cape) exten => s,n,Goto(set_tenant) exten => s,n(tenant_jeffcity),Set(x_tenant=tenant.jeffcity) exten => s,n,Goto(set_tenant) exten => s,n(tenant_quincy),Set(x_tenant=tenant.quincy) exten => s,n,Goto(set_tenant) exten => s,n(set_tenant),NoOp(Based on the outbound route name of ${OUTBOUND_ROUTE_NAME}, the X-Tenant is being set to ${x_tenant}.) exten => s,n,GoSub(func-set-sipheader,s,1(X-Tenant,${x_tenant})) exten => s,n(exit_macro),MacroExit()
So
ExecIf
executes all threeExecIf
statements, and if one is true, one of theSet
statements. So always 3 and sometimes 4 operations everytime a call is placed.With the
GotoIf
it can execute 3 checks, then aGoto
if nothing matches.
Or 1 check, a gotoif, a set, and a goto for 4 operations. Both of these were 4 operations.
If the second gotoif kicks, it means 5 total operations, and 6 total operations if the third one is applied.So if you apply the
GotoIf
logically based on how often they are called, with the most used ones at the beginning of the logic flow, you can drastically reduce the number of calls compared toExecIf
if there are a lot of routes. -
Also, it was my assumption that @Skyetel tracks all inbound and outbound if you choose to associate the endpoint group to a Tenant. The documenation was unclear.
This is all still decently early in release for them though, so no complaints about documentation from me. Mine is far worse.
-
This is fully working now. I tested calls and saw all of the correct X-Tenant headers in the outbound
INVITE
messages
Outbound routing changed as of now, to give a short time of low call volume as a pseudo test.
-
Not trying to threadjack.
Just an fyi, in FusionPBX, this is included by default. -
@JaredBusch nice! What tool are you using in that screenshot to look at call flow?
-
@fuznutz04 said in Setting up FreePBX to send a X-Tenant SIP header for Skyetel Tenant tracking:
@JaredBusch nice! What tool are you using in that screenshot to look at call flow?
-
@FATeknollogee Thanks!
-
@FATeknollogee said in Setting up FreePBX to send a X-Tenant SIP header for Skyetel Tenant tracking:
Not trying to threadjack.
Just an fyi, in FusionPBX, this is included by default.That has nothing to do with anything as the thread was specifically about setting up FreePBX.
FusionPBX is not ever Asterisk based so nothing especially matters about what works in that.
-
@fuznutz04 said in Setting up FreePBX to send a X-Tenant SIP header for Skyetel Tenant tracking:
@FATeknollogee Thanks!
Sangoma has included it by default since FreePBX 14. It was available via yum in FreePBX 13.
-
All outbound calls were routed out to @Skyetel for the entire day.
Users were completely unaware of any changes. This is how things are supposed to work.
535 minutes used.
Only 5 simultaneous channels.
-
@JaredBusch we did a port over to Skyetel for a busy utility today, too.
-
This is great. Thanks.
What is this significance to the numbers within the "{OUTBOUND_ROUTE_NAME:0:4}" preceding the route name?
-
@cdbrush said in Setting up FreePBX to send a X-Tenant SIP header for Skyetel Tenant tracking:
This is great. Thanks.
What is this significance to the numbers within the "{OUTBOUND_ROUTE_NAME:0:4}" preceding the route name?
That’s a substring. Look at the route name, starting at character zero and going for 4 characters.