ArduinoVoip
ArduinoVoip copied to clipboard
Incoming call accepted, Status = call!
if incoming call accepted, cannot get cancel if caller hang up the call.
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 https://github.com/rousir/ArduinoVoip/blob/d09927c316491cbaf43aa2d21cc83b6f86ab5f45/src/SipHeader.cpp#L40
https://github.com/rousir/ArduinoVoip/blob/d09927c316491cbaf43aa2d21cc83b6f86ab5f45/src/SipMachine.cpp#L283
If the caller cancels the call : https://github.com/rousir/ArduinoVoip/blob/d09927c316491cbaf43aa2d21cc83b6f86ab5f45/src/SipMachine.cpp#L122 if caller calling and answered, speak, and caller hang up. Esp no get respondcode, still lopoping in here!
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
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
Ok, fix now for re registering issues!
pls see the code https://github.com/rousir/ArduinoVoip/blob/d09927c316491cbaf43aa2d21cc83b6f86ab5f45/src/SipMachine.cpp#L190
its on if condition if (sipHeader.contentLength > 0) {
}
its work?
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
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
After receiving the call, esp needs to send the answer command many times to answer it normally? 收到呼叫后,esp需要发很多次接听命令才能正常接听?
i think esp no send command many time.. and auto hangup after 10sec accept call
the call problem ended outomatic after 10 second solved.. but if caller hang up, caller not send BYE..
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 ->