Re: [Asterisk-java-users] Wrong PJSIP_HEADER read
Brought to you by:
srt
From: Salahuddin A. <tx...@gm...> - 2018-12-21 00:08:46
|
Hello, Let's explain the issue, In our agi script has those following header read, AGI Code: ========================================= String fromHeader = getHeaderValue("FROM"); String paidHeader = getHeaderValue("P-ASSERTED-IDENTITY"); String privacyHeader = getHeaderValue("PRIVACY"); String toHeader = getHeaderValue("TO"); ========================================= 4573 port trace ========================================= T 172.32.60.11:4573 -> 172.32.10.70:38630 [AP] GET VARIABLE"PJSIP_HEADER(read,FROM)". # T 172.32.10.70:38630 -> 172.32.60.11:4573 [AP] HANGUP. # T 172.32.60.11:4573 -> 172.32.10.70:38630 [AP] GET VARIABLE "PJSIP_HEADER(read,P-ASSERTED-IDENTITY)". # T 172.32.10.70:38630 -> 172.32.60.11:4573 [AP] 200 result=1 (<sip:12016615429@172.32.100.100>;tag=1). # T 172.32.60.11:4573 -> 172.32.10.70:38630 [AP] GET VARIABLE "PJSIP_HEADER(read,PRIVACY)". # =========================================== When a new call arrived those lines are executing, and during that execution, if caller canceled the call then a HANGUP message send from asterisk to asterisk-java. If asterisk-java waits for any response of one of those 4 requests then I think asteris-agi get confused and the all further response will be shifted. Now according to code if asterisk-java received a response without "200 result=1" format, it discards that response, but this response does not belong to that request. In the next read, the actual value will appear. Now in this scenario, what would be the solution? could anyone please suggest this? Thanks, Salah Ahmed On Tue, Dec 18, 2018 at 1:31 PM Salahuddin Ahmed <tx...@gm...> wrote: > Hello, > > Recently I have noticed an error in my service. After some investigation, > we found that its due to some calls is terminated very early. > > The scenario is, If Caller-A sends an INVITE to Asterisk, This INVITE > processed on an agi method. On that method, we read several sip custom and > default sip header for our processing. > > But during this processing, if Caller-A sends CANCEL then some header > value read get malformed. Actually, it seems it gets shifted, suppose if we > read To header first and then cseq, TO header value set to cseq value and > TO return NULL. We have added some debug log in asterisk code and found, > asterisk return good value. The time between INVITE and CANCEL is 50 ms. > > We have implemented AGIHangupException in our agi method, but this > exception does not catch by this CANCEL request. > > Any idea/solution is appreciated. > > Thanks in advance, > Salah Ahmed > |