theintencity / php-sip

Automatically exported from code.google.com/p/php-sip
3 stars 1 forks source link

486 code wrongly associated with call #19

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
When i have multiple calls sessions recieved response from server is associated 
with new session. For Example
1. Make a call#1
2. Call#1 is timed out with "No final response in fr_timer seconds." on my 
side, but on callee side client still rings.
3. Make call#2. There are 2 rings on callee side now.
4. Callee rejects call#1
5. Call#2 stops on my side with 486 code  

It can also be some delayed response from callee side.

So i suppose there should be Call-ID check.

I added field

private $res_call_id;

Then in send() function
if($this->method = 'INVITE' && $this->res_code == '486')
    {
      $i=0;
      while($this->call_id!=$this->res_call_id && i<2)
      {
        $this->readResponse();
        $i++;
      }
    }

And in parseResponce() function

$result=array();
    if(preg_match('/^Call-ID:(.*)$/im',$this->response,$result))
    {
        $this->res_call_id =trim($result[1]);
    }

Works fine for me.

Original issue reported on code.google.com by kiim11....@gmail.com on 16 Oct 2013 at 2:11