New question related to custom device state. It’s the way I planned to manage “hints” in my hotdesking solution. The customer is only interested in 3 states : Unavailable, Idle or In Use.
Managing Unavailable and Idle will be done in my login/logout logic.
For In use status, I have the idea to use the option U of the Dial() application.
I could also have used the option M of the Dial() application but since Gosub seems the successor of Macro, I prefer to capitalize on this option…
U( x^arg ) - Execute via ‘Gosub’ the routine x for the called channel before connecting to the calling channel.
The idea is to get the two legs of the call and change the state accordingly.
In case of internal call : could be interesting to get the two legs of the calls to flag them as In use (even if I could also rely on caller id and “target” extension, but anyway I want to change the status only if the two legs are “really” connected).
In case of external call : I’m of course interested by the (internal) extension/endpoint that is answering the call (the other leg being anyway my ITSP).
Based on the endpoint(s) involved, I could easily get corresponding extension(s) based on my database.
Any idea on this ? Channel variable that I could use ? Or any other “trick”
There might be a system variable for this, but simply setting a variable to the value of CHANNEL before calling Dial, and marking it as inheritable, with underscore, will make it available on the called channel.
I finally had the time to play a litle bit with this option U.
In the Gosub, I have no problem to change the state of the “source” and “target” leg as INUSE.
The “source” leg (linked to “main” channel) is passed as an argument to Gosub (could also be an inheritable variable indeed).
The “target” leg is evaludated in the Gosub (“secondary” channel).
My plan was to return the “target” leg value and to use this value in the h extension to switch back “source” and “target” leg state to NOT_INUSE.
But thath doesn’t work…
I understant that the “main” and the Gosub scope are two different channels but I was hoping that Return() would allow to pass a value from one to the other…
Any idea how to handle that ?
The first idea that pops in my mind
Generate a GUID in the “main” channel. Pass this GUID as an argument to the Gosub.
In the Gosub, store the GUID, “source” and “target” leg in the MySQL using func_odbc
When calling the h extension (linked to “main” channel), get the two legs based on the GUID and set their status to NOT_INUSE.
I think that would work but there is perhaps a more “straightforward” solution