Monitoring a custom trunk type...

I have a custom trunk type that dials local DID when required.
The trunk has a name "Loopback" - it is type "custom" and dials:
I'm trying to write a trunk definition to monitor the usage of this virtual "trunk".
I've tried variations based on the technology "custom" (custom/Custom/CUSTOM) and the dial string (local / Local / LOCAL) to account for the differences like how iax trunks are matched as IAX2 - but still doesn't work.
Any suggestion appreciated - I even tried a "local/NPANXXXXXX" style entry but even that didn't work.



  • Hi,
    Local pseudo channels are destroyed as soon as control is passed to the 'real' channel/application. So using Local/xx as a device is short lived in FOP2, maybe it does get status but very briefly. The way to 'fix' (if we can call this a fix), is to make the local chanel linger for as long as masquerading channels live, by using the /n suffix, so, in your dial application, the channel would be


    With that set, whenever you use that channel, if you do an

    asterisk -rx "core show channels concise"

    Then you will see the Local/xxxx@yyyyy channel up during the complete duration of the call.

    Now, in FOP2, you must use the channel name as depicted in the output from core show channels, but without the -session suffix, so if you see something like


    In FOP2 the channel to monitor would be Local/1234@from-trunk

  • Thanks - the way I use the trunk I already have persistent channels. So that part is ok. I can see them with core show channels concise.
    In the below code, XXXXXXX is replaced by a single real phone number.
    I added a trunk like:
    Now, what I need ideally is a way to wildcard this... does the [ ] section allow some sort of wildcard or regex?
    My issue is that I want to catch all those channels in one "trunk" so I can see all the people placing calls internally.
    If not readily possible is there any pointer to where in the code I would look or edit?

  • Hi,
    Unfortunately there is no way to specify wildcard matching on device names. I am not sure if its possible to find a way to monitor that unless you can have a fixed channel name that could be used.

    Why are you using a custom trunk in this way? You want to perform iax calls to your own box? I think you can do that without using a custom trunk... Consider this on an IAX trunk configuration:

    In iax_general_custom.conf or similar file add

    calltokenoptional =

    Then you can use normal dial rules to call your iax trunk directly, without custom trunks created, call will go out your box, and INTO your box, working as a loopback and using real IAX channels.

    This example is for Issabel, in FreePBX will be very similar, perhaps with no need for the custom entry if they have some checkbox or similar on advanced settings, not sure about it.

    Best regards,

  • Hi the issue is a bit more complex. I created the route as a catch-all to prevent did handled by inbound routes from wasting two channels... One out and one in. Sometimes those calls are even mishandled by our carriers resulting in failed calls when the call is actually made between two people on the same system just using did instead of extensions.

    We've also found other methods caused problems. iax sometimes creates issues for DTMF and fax.

    This method results in working call records for both parties (one "out" and one "in" but no additional network traffic or load.

    I could document the process for you for an FAQ? Maybe it is something that could be added for a future version?

  • Thanks Mitch, if you want to share your setup you are welcome to do so.. As for adding wildcard channel support, I am not keen to the idea. I did add that to the old FOP1 but was overkill, it requires too much processing and will make fop2 server unresponsive. Also, lots of complications are derived from that as actions require a specific channel name... Not sure if something like that will be added any time soon...

    Best regards,

  • Ok cool thanks for the candor. Will try to find a way to masquerade the channels.

Sign In or Register to comment.