Het is mogelijk om met een Arduino+Ethernet Shield een SIP telefoon over te laten gaan, wat je wel nodig hebt zijn je SIP account gegevens zoals server IP, poort, gebruikersnaam, wachtwoord, etc.
Wat heb je nodig?
Versie 1 van het script:
Here is my current working code. It can now connect with UDP or TCP to the SIP server and let phones ring. But there are still issues:
- CANCEL to stop the ringing does not work. It is rejected by my SIP server with a leg/transaction does not exist error, however I could not yet spot my faulty parameters.
- Currently the code uses an incorrectly (to my current knowlegde) formated Via, otherwise the phone will not ring.
- Using UDP gives lots of unathorized and declined messages from the SIP server, but the phone rings nevertheless.
To stop the ringing you have to reject the call from the called phone or wait for some timeout.
I have a network capture of a UDP session with a working cancel, but this is quite complicated, I will try to implement this on my arduino as soon as I find some time. If I have working code, I could then strip it down to what is really required.
A mega is required because of code size.
These libraries are required:
See the first line of setup() to configure SIP server IP and port, SIP user, SIP pwd and the phone nr. to dial.
Versie 2 van het script:
Got it working now.
Attached is code that can dial a tel. nr., the called phone rings and after 10 secs. the call is canceled.
What is still missing:
- Error handling
- Refactoring into some reusable code/lib
- The SIP Via header needs to be constructed with a syntax error, otherwise it does not work. I have currently no idea what the problem is.
See setup() for configuration.
Versie 3 van het script:
Latest code version, refactored to an arduino library.
Versie 4 van het script:
in the SIPRinger.cpp I added the recognition of an answered call, to stop the tcpClient and set the status to SIP_STATE_DONE
I integrated your fix. Attached is the latest code which has also a memory leak fixed.