hello,
what is the usual method to use the cpl module when a pstn gateway needs to know which user is responsible a call?
e.g. i have a pstn gateway pstn.example. numbers are dialed by specifying them as user part of a sip uri => 00321234@pstn.example. as the gateway is an asterisk box i'm rather flexible in choosing a method which specifies how the name of the remote-user is transfered to the gateway.
if a user does a forward to the pstn (e.g. in the case of no-answer) he should also be accounted for the call - so i either need to set the 'From' header to the owner of the cpl script or i need to add another header like 'X-account' which specifies the owner.
a solution for this seems to be to store the name of the callee in an AVP before executing the script and to set the From field in proxy_route after the script has started.
are there better or more-standard solutions for this problem?
bye, /gst
Hi Günther,
if you do serial forking by using cpl, is quite difficult to set and add any specific header to advertised the party to be billed - and this is due the encapsulation of the cpl interpreter : once you started, you have your hands off the execution and you cannot control it or attach additional stuff to it.
indeed, a small possibility is by setting a script route to be executed just before cpl forwards a request: http://www.openser.org/docs/modules/1.1.x/cpl-c.html#AEN111 it will help you to make last changes on the request - adding headers, etc. But the remaining problem is to actually set the URI to be billed during cpl execution. Each time the cpl does a serial fork, it will have to update that URI...I thing this is the missing piece.
If you use only scripting, you have full flexibility :).
regards, bogdan
Günther Starnberger wrote:
Bogdan-Andrei Iancu wrote:
hello,
adding a header is all i need to do as only calls to the pstn are accounted and the cdrs are written on the pstn-gateway.
my initial plan was the following: 1) on an incoming call add an AVP which contains the callee 2) execute the CPL interpreter 3) in proxy_route check if the actual callee is equal to the AVP. if this is not the case there was a forward -> put the value from the AVP into the From header (or the rpid header).
although the whole logic is in the CPL module the user who should be accounted is always the same one - the owner of the script. or do i miss something?
if a@local has setup a forward to b@local the cpl interpreter is first executed for user a@local and then relays the call to b@local which starts a new transaction (for the incoming call to b@local) so that i have the chance to put the new callee (b@local) in the AVP again. is this right?
if the above isn't possible i could try to add the missing functionality to the CPL module myself. how hard do you assume is it for someone who doesn't know the internal structure of openser but who has c programming experience to add the missing code?
bye, /gst
Hi Günther,
Günther Starnberger wrote:
I would say it's possible to do it with what we have now (based on your plan) 1) on incoming call and in an AVP the RPID or if not present, the FROM URI (as party to be billed) 2) run CPL 3) in proxy_route, remove the existent RPID hdr and add it with the content from AVP.
all the time the RPID will contain the party to be billed and the GW should use this info.
regards, bogdan
Bogdan-Andrei Iancu wrote:
Ok - tnx - i'll try to implement this and write a short howto if it works out.
One CPL related thing which isn't clear to me yet: According to the Admin Guide at http://www.iptel.org/ser/doc/seruser/seruser.html [Open]SER is not call-stateful. The way that I understand this is that a BYE is (for SER) totally unrelated to the INVITE request.
But how does this work in combination with the CPL logic? E.g. a user is busy and so the incoming call gets forwarded to 'foo@bar'. How does the CPL engine know that the BYE packet should also be forwarded to 'foo@bar' instead of processing the call logic from the beginning?
bye, /gst