Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incoming call accepted, Status = call! #2

Open
indotronic opened this issue Mar 7, 2021 · 11 comments
Open

Incoming call accepted, Status = call! #2

indotronic opened this issue Mar 7, 2021 · 11 comments

Comments

@indotronic
Copy link

if incoming call accepted, cannot get cancel if caller hang up the call.

@rousir
Copy link
Owner

rousir commented Mar 8, 2021

If the call is answered, send call hang up command to hang up the phone

void SipMachine::bye()
{
    sipBye();
    status = idle;
}

If the caller cancels the call, esp32 will reset the state after receiving the bye command

if (in.indexOf("BYE sip:") > -1)

@indotronic
Copy link
Author

If the caller cancels the call :

if ((status == call) & (timeStOut % 20000 == 0))

if caller calling and answered, speak, and caller hang up. Esp no get respondcode, still lopoping in here!

@indotronic
Copy link
Author

indotronic commented Mar 8, 2021

and if time experied the sip cannot re-registering!
in debug show
07:27:39.221 -> sip server disconnected, reconnect...
07:27:39.256 -> Connect SIP Client on IP 192.168.43.202 Port 5060 ret= true
07:27:39.256 -> ***** Register *****
07:27:39.256 -> REGISTER sip:192.168.43.202 SIP/2.0
07:27:39.256 -> Via: SIP/2.0/TCP 192.168.43.54:5060;branch=z9hG4bK-0Oi2Qc1Kf6Od3Ws5Sq4Pf8Tw6We5Kx
07:27:39.256 -> Max-Forwards: 70
07:27:39.290 -> From: sip:[email protected]:5060;tag=
07:27:39.290 -> To: sip:[email protected]:5060;tag=as7c2038dd
07:27:39.290 -> Call-ID: [email protected]:5060
07:27:39.290 -> CSeq: 1 REGISTER
07:27:39.290 -> User-Agent: esp32 sip
07:27:39.290 -> Contact: sip:[email protected];transport=TCP
07:27:39.290 -> Allow: INVITE,ACK,OPTIONS,BYE,CANCEL,SUBSCRIBE,NOTIFY,REFER,MESSAGE,INFO,PING
07:27:39.290 -> Content-Length: 0

@rousir
Copy link
Owner

rousir commented Mar 10, 2021

Okay, I didn’t encounter this problem during the test. I have been busy recently. I will check it when I have time.
The sip protocol is simple, you can use the debug information to check that the step was unsuccessful

@indotronic
Copy link
Author

Ok,
fix now for re registering issues!

pls see the code

if (sipHeader.contentLength < 0)

its on if condition
if (sipHeader.contentLength > 0)
{

}

its work?

@rousir
Copy link
Owner

rousir commented Mar 12, 2021

if (sipHeader.contentLength > 0)
{
    sipHeader.contentLength -= (str.length() + 1);
    debugL1_println(str.c_str());
    parserSdp(str);

    if (sipHeader.contentLength < 0)
    {
        exec();

        if (status == messageIn) {
            debugL1_println(str.c_str());
            messageData = str;
        }
    }
}

It works and is used to detect the content of the sip body

@indotronic
Copy link
Author

If incoming call show log it

19:08:37.381 -> 192.168.43.54
19:08:37.381 -> Init i2s amp...
19:08:37.719 -> Respons Code = 401
19:08:38.026 -> Respons Code = 401
19:08:38.225 -> Respons Code = 200
19:08:38.225 -> REGISTER OK
19:08:52.141 -> Respons Code = 200
19:08:52.141 -> REGISTER OK
19:09:07.408 -> Respons Code = 2
19:09:07.408 -> Ringing Call Nr. 2013
19:09:12.389 -> Accept incoming Call 2013
19:09:12.389 -> Accept call
19:09:12.422 -> Accept call
19:09:12.725 -> Accept call
19:09:12.725 -> Accept call
19:09:12.725 -> Accept call
19:09:12.725 -> Respons Code = 0
19:09:13.361 -> Respons Code = 2
19:09:13.361 -> Ringing Call Nr. 2013
19:09:18.379 -> Accept incoming Call 2013
19:09:18.379 -> Accept call
19:09:18.379 -> Accept call
19:09:18.379 -> Accept call
19:09:18.379 -> Accept call
19:09:18.379 -> Accept call
19:09:18.379 -> Accept call
19:09:18.447 -> Accept call
19:09:18.447 -> Accept call
19:09:18.447 -> Respons Code = 0
19:09:18.547 -> Respons Code = 1
19:09:18.547 -> 2013 Bye Call

@rousir
Copy link
Owner

rousir commented Mar 15, 2021

After receiving the call, esp needs to send the answer command many times to answer it normally?
收到呼叫后,esp需要发很多次接听命令才能正常接听?

@indotronic
Copy link
Author

indotronic commented Mar 17, 2021

i think esp no send command many time..
and auto hangup after 10sec accept call

@indotronic
Copy link
Author

the call problem ended outomatic after 10 second solved.. but if caller hang up, caller not send BYE..

@indotronic
Copy link
Author

if make call not work, just show

***** Invite *****
15:39:32.035 -> INVITE sip:[email protected] SIP/2.0
15:39:32.035 -> Via: SIP/2.0/TCP 192.168.43.202;branch=z9hG4bK-4Hs5Jq4Vp4Vk2Xk0Sm1Bv1Mc2Bc8Ri;rport;alias
15:39:32.035 -> To: sip:[email protected]
15:39:32.035 -> From: sip:[email protected];tag=
15:39:32.035 -> Call-ID: [email protected]
15:39:32.035 -> CSeq: 1 INVITE
15:39:32.035 -> Contact: sip:[email protected];transport=TCP
15:39:32.035 -> User-Agent: esp32 sip
15:39:32.035 -> Supported: replaces
15:39:32.035 -> Allow: ACK,PRACK,BYE,CANCEL,INVITE,UPDATE,MESSAGE,INFO,OPTIONS,SUBSCRIBE,NOTIFY,REFER
15:39:32.070 -> Allow-Events: presence,refer,telephone-event,keep-alive,dialog
15:39:32.070 -> Accept: application/sdp,application/dtmf-relay,text/plain
15:39:32.070 -> Content-Type: application/sdp
15:39:32.070 -> Content-Length: 182
15:39:32.070 ->
15:39:32.070 -> v=0
15:39:32.070 -> o=2012 65485742 50506087 IN IP4 192.168.43.54
15:39:32.070 -> s=esp32 sip
15:39:32.070 -> c=IN IP4 192.168.43.54
15:39:32.070 -> t=0 0
15:39:32.070 -> m=audio 64389 RTP/AVP 8 127
15:39:32.070 -> a=rtpmap:8 PCMA/8000
15:39:32.070 -> a=rtpmap:127 telephone-event/8000
15:39:32.104 ->

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants