Giter VIP home page Giter VIP logo

sipsorcery's People

Contributors

apdevelop avatar bitbound avatar camnewnham avatar christophei avatar davidmartynwood avatar dependabot[bot] avatar dmoskalyk avatar dov1 avatar edossantos-sipcaller avatar grondinjc avatar henlil avatar ixyj avatar jp-fournier-dev avatar kuleshov-aleksei avatar mahald avatar markciliavincenti avatar oto313 avatar pashcovich avatar pedoc avatar rafcsoares avatar raschle avatar rj2skipper avatar robinsonwm avatar rory-reid avatar sipsorcery avatar tarasov65536 avatar theimowski avatar tstaehli avatar yitzchok avatar ynborokh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sipsorcery's Issues

Wireshark IP in RTPChannel File

In RTPChannel.cs there is "10.1.1.3:10001" Wireshark information hard-coded it seems very specific to someone's setup or is there another reason why it's there like debugging?

private static IPEndPoint _wiresharkEP = new IPEndPoint(IPAddress.Parse("10.1.1.3"), 10001);
...
_rtpSocket.SendTo(buffer, bytesRead, SocketFlags.None, _wiresharkEP);

It's UDP so it will probably just be a fire and forget if no one is listening at that port. But it does seem like a security issue and a good debug optional feature.

NullReferenceException in SIPClientUserAgent.Call

                ServerTransaction.CancelCall("Unresolvable destination " + callURI.Host);

ServerTransaction is null because DNS resolution fails.

Still looking for why DNS resolution is failing since it works for me in the softphone project

Peer to peer SIP communication with multiple Network interfaces

Hi,

I am facing an issue with the sipsorcery library. I use the library only in peer to peer mode : call from 192.168.0.12 to 192.168.0.23 for example.

I cannot make the library work with multiple network interfaces on my computer. I'm working on a laptop, i got internet access with 192.168.0.10 address by wifi and I have a connection to an Axis intercom through ethernet with address : 192.168.2.10.

I made a wpf application that register every network interfaces channel, I want to be able to recieve calls from every network adapters. So my program use the method SIPTransport.AddSipChannel for the 192.168.0.10 AND 192.168.2.10 IP address. But when I try to call the device with the ip address 192.168.2.88, I get an error : cannot reach device on unreachable network.
Then I notice in the CallFailed callback that the field m_localSIPEndPoint is 192.168.0.10 so it cannot reach the 192.168.2.x.

So I note that m_sipTransport.GetDefaultSIPEndPoint(m_serverEndPoint) method was only checking the protocol of the endpoint and return the first channel that match with UDP protocol. And both of the channels (192.168.0.10 and 192.168.2.10) use udp.

Is there a way in the current version to make this work ? Or do you I have to change the code of the call method inside the SIPClientUserAgent ?

Thank you.

Best regards.

Support SIPDialogue.Refer

Hi
Would be nice to support the REFER command on SIPDialogue to be able to transfer a ongoing call.

hold

what about hold?

No Sequence Elements in SIPTransport.GetDefaultEndPoint

Cause is elements being added to m_sipChannels dictionary while collection is being enumerated.

Suggest changing dictionary to concurrent, or putting locks around the add and remove steps and a method of just grabbing the collection of values inside the same lock.

Suspect this is timing dependent / DNS resolution as a retry usually succeeds

How to call without Video?

Hi.
Very good lib. Can you show, how to use only microphone (default mic) and talk via mic? All my video-devices not supported by this lib (I don't know, why). So, I need to make call only with voice. Sorry for my Russian English. Can you help me?

urgent: TLS inbound

Hey Aaron,
following scenario:

  • SipTlsChannel is listening
  • receive SIP-Options Request
  • building SipResponse via SIPTransport.GetResponse(sipRequest, SIPResponseStatusCodesEnum.Ok, null)
  • trying to Send by calling mySipTransport.SendResponse(okResponse) <- FAILS with ApplicationException("The SIP TLS Channel must be provided with the name of the expected server certificate, please use alternative method.") because Send method does not know anything about a certficate(name)

continuing scenario:

  • Sending INVITE to (TLS)RemoteEndpoint (call is connected etc.)
  • receive SIP-Options Request
  • building SipResponse via SIPTransport.GetResponse(sipRequest, SIPResponseStatusCodesEnum.Ok, null)
  • trying to Send by calling mySipTransport.SendResponse(okResponse) <- everything OK

what changed?

  • SIPConnection was found in m_connectedSockets

Where would I begin to fix this, that incoming Requests could get answered without requiring outbound connection first?

Ralf

How to support DTMF out of band?

Hi Aaron.

I'm looking at having to support DTMF via OOB using SIPSorcery.
So far pretty much everything in the service providers end has seemed to change for this project.

I've got little idea where to start, but it looks like I need to check the invite for
a=rtpmap:101 telephone-event/8000

And then connect a port to an RTPChannel to handle it if it's present?

And from reading through the RTPChannel and RTPPacket code, the RTPPacket should be fine, but RTPChannel assumes it is either a single packet audio frame, or a video frame, so I would need to implement a DTMF RTPChannel?

SIPSorcery.SoftPhone v2 Hangup incoming calls not working

SoftPhone application successfully accepts incoming call, establishes audio channel, but refuses to do hangup procedure properly.
The possible fix is adding check for m_uas state to these lines:
https://github.com/sipsorcery/sipsorcery/blob/9ecaafb996a9d5ab4deccb22fa241c8acf5f0ab5/sipsorcery-softphonev2/SIPSorcery.SoftPhone/Signalling/SIPClient.cs#L318-L323
something like (because m_uac is null in case of incoming call)

    else if (m_uas != null && m_uas.SIPDialogue != null)
    {
        m_uas.SIPDialogue.Hangup(m_sipTransport, null);
    }

But it seems not enough to fix, the another party doesn't receive proper BYE message. Tested with Yealink T19 E2 IP phone and Blink client on the other end, using sip2sip.info SIP provider.

Double SIP messages

Dear SIPSorcery team!

As I am implementing a hold/unold feature in the softphone project I have noticed, while using WireShark, that all SIP packets get sent twice. They have the same CSeq and do not seem to bother the PBX but it seems like this is not something that should be good practice.

We have not updated the repository in a while so I was just wondering wether or not You have already found a solution for this and if we should start merging to resolve this issue.

The second problem is that when a "reliable" message is sent (especially the ReINVITE which we ar eusing for holding and unholding a call) the SoftPhone does not stop sending it in the "reliable" thread, we have already found a work around for this but just wanted to inform You of the issue.

The last issue is that when we create a hold with the ReINVITE we don't seem to be able to get any other calls from the PBX, while doing it on another client this seems to work fine, so we were also wondering if You had any insight as to why this might be happening. Are we missing a header or SDP parameter int he ReINVITE? We have tried copying the SDP sent from antoher client but even while all of the parameters are synchronized this still seems not to work as it should.

We thank You for Your help!

With kind regards, Urban.

EARLY OFFER VS. LATE OFFER

As I'm understanding the code right now, i don't see a possibility for the "Late" or "Delayed" offer scenario,
Early = SDP in INVITE
Late = INVITE without SDP, SDP in ACK

I'd like to discuss a way to implement it, without breaking the allready working sipsorcery framework.

Ralf

Potential incompatibility with the way Cisco Webex expects SIP Invites

I'm trying to use SipSorcery to connect (as a guest) to a Cisco Webex video conference (I'm intending to capture video/audio with ffmpeg or gstreamer so the lack of codec support in SipSorcery is not a concern). In webex I got my SIp address of [email protected]. So I wrote the following code:

        public static void Main(string[] args)
        {
            var address = STUNClient.GetPublicIPAddress("stun.ideasip.com");
            var sipUri = new SIPURI("xxxx", "meet.ciscospark.com", "", SIPSchemesEnum.sips, SIPProtocolsEnum.tls);

            var sipTransport = new SIPTransport(SIPDNSManager.ResolveSIPService, new SIPTransactionEngine());
            sipTransport.SIPTransportRequestReceived += SIPRequestReceived;
            sipTransport.SIPTransportResponseReceived += SIPResponseReceived;
            sipTransport.SIPRequestOutTraceEvent += SipTransportOnSipRequestOutTraceEvent;
            sipTransport.SIPResponseInTraceEvent += SipTransportOnSipResponseInTraceEvent;

            var cert = GenerateCertificate("test");
            SIPTLSChannel tlsChannel = new SIPTLSChannel(cert, new IPEndPoint(IPAddress.Any, 5061));
            sipTransport.AddSIPChannel(tlsChannel);

            var fromHeader = new SIPFromHeader("test", SIPURI.ParseSIPURI(SIPFromHeader.DEFAULT_FROM_URI), null).ToString();
            var userAgent = new SIPClientUserAgent(sipTransport, null, null, null, null);
            var sdp = GenerateSDP();
            var callDescriptor = new SIPCallDescriptor("test",
                null,
                sipUri.ToString(),
                fromHeader,
                null,
                null,
                null,
                null,
                SIPCallDirection.Out,
                "application/sdp",
                sdp,
                null);

            userAgent.Call(callDescriptor);
        }

With this I get the following output:

2018-06-07 12:11:22,225 [1] DEBUG sipsorcery [(null)] - Logging initialised.
2018-06-07 12:11:22,400 [1] DEBUG sipsorcery [(null)] - STUNClient attempting to determine public IP from stun.ideasip.com.
2018-06-07 12:11:22,607 [3] DEBUG sipsorcery [(null)] - STUNClient Response to initial STUN message received from 217.10.68.152:3478.
2018-06-07 12:11:22,614 [3] DEBUG sipsorcery [(null)] - STUNClient Public IP=199.26.74.234.
2018-06-07 12:11:23,242 [1] DEBUG siptls-channel [(null)] - SIP TLS Channel listener created 0.0.0.0:5061.
2018-06-07 12:11:23,258 [siptls-5061] DEBUG siptls-channel [(null)] - SIPTLSChannel socket on tls:0.0.0.0:5061 accept connections thread started.
2018-06-07 12:11:23,584 [1] DEBUG dnslookup [(null)] - Initialising DNS resolver with operating system DNS server entries.
2018-06-07 12:11:23,615 [1] DEBUG dnslookup [(null)] - DNSManager lookup queued for SRV _sips._tcp.meet.ciscospark.com, queue size=1, in progress=1.
2018-06-07 12:11:23,616 [dnslookup-2] DEBUG dnslookup [(null)] - DNSManager thread dnslookup-2 looking up SRV _sips._tcp.meet.ciscospark.com.
2018-06-07 12:11:23,620 [dnslookup-2] DEBUG sipsorcery [(null)] - Resolver sending UDP DNS request to 8.8.8.8:53 for SRV _sips._tcp.meet.ciscospark.com..
2018-06-07 12:11:23,691 [dnslookup-2] DEBUG sipsorcery [(null)] - Caching DNS lookup success for IN-SRV-_sips._tcp.meet.ciscospark.com..
2018-06-07 12:11:23,692 [dnslookup-2] DEBUG dnslookup [(null)] - DNSManager resolve time for _sips._tcp.meet.ciscospark.com SRV 75.9838ms.
2018-06-07 12:11:23,694 [dnslookup-2] DEBUG dnslookup [(null)] -  result: priority=5, weight=10, port=5061, target=l2sip-cfa-01.wbx2.com..
2018-06-07 12:11:23,695 [dnslookup-2] DEBUG dnslookup [(null)] -  result: priority=5, weight=10, port=5061, target=l2sip-cfa-02.wbx2.com..
2018-06-07 12:11:23,709 [1] DEBUG dnslookup [(null)] - DNSManager lookup queued for A l2sip-cfa-01.wbx2.com., queue size=1, in progress=1.
2018-06-07 12:11:23,710 [dnslookup-1] DEBUG dnslookup [(null)] - DNSManager thread dnslookup-1 looking up A l2sip-cfa-01.wbx2.com..
2018-06-07 12:11:23,712 [dnslookup-1] DEBUG sipsorcery [(null)] - Resolver sending UDP DNS request to 8.8.8.8:53 for A l2sip-cfa-01.wbx2.com..
2018-06-07 12:11:23,754 [dnslookup-1] DEBUG sipsorcery [(null)] - Caching DNS lookup success for IN-A-l2sip-cfa-01.wbx2.com..
2018-06-07 12:11:23,756 [dnslookup-1] DEBUG dnslookup [(null)] - DNSManager resolved A record for l2sip-cfa-01.wbx2.com. to 13.59.223.3 in 45.997ms.
2018-06-07 12:11:23,818 [1] DEBUG siptls-channel [(null)] - Attempting to establish TLS connection to 13.59.223.3:5061.
Sending sip message:
INVITE sips:[email protected];transport=tls SIP/2.0
Via: SIP/2.0/TLS 0.0.0.0:5061;branch=z9hG4bKbe4d35839576456d9af0df1ef19cfe7a;rport
To: <sips:[email protected]>;transport=tls
From: "test" <sip:[email protected]>;tag=CNPYRUXCTX
Call-ID: e7e3611aff604397a66e03d6b1e4f61c
CSeq: 1 INVITE
Contact: <sips:[email protected]:5061;transport=tls>
Max-Forwards: 70
User-Agent: www.sipsorcery.com
Content-Length: 157
Content-Type: application/sdp

v=0
o=-
s=-
t=0 0
c=IN IP4 199.26.74.234
m=audio 12688 RTP/AVP 97
a=rtpmap:97 MPEG4-GENERIC/44100/2
m=video 12666 RTP/AVP 96
a=rtpmap:96 H264/90000

2018-06-07 12:11:24,079 [4] WARN  siptls-channel [(null)] - Certificate error: RemoteCertificateNameMismatch
2018-06-07 12:11:24,092 [4] DEBUG siptls-channel [(null)] - Established TLS connection to 13.59.223.3:5061.
Sending sip message:
INVITE sips:[email protected];transport=tls SIP/2.0
Via: SIP/2.0/TLS 0.0.0.0:5061;branch=z9hG4bKbe4d35839576456d9af0df1ef19cfe7a;rport
To: <sips:[email protected]>;transport=tls
From: "test" <sip:[email protected]>;tag=CNPYRUXCTX
Call-ID: e7e3611aff604397a66e03d6b1e4f61c
CSeq: 1 INVITE
Contact: <sips:[email protected]:5061;transport=tls>
Max-Forwards: 70
User-Agent: www.sipsorcery.com
Content-Length: 157
Content-Type: application/sdp

v=0
o=-
s=-
t=0 0
c=IN IP4 199.26.74.234
m=audio 12688 RTP/AVP 97
a=rtpmap:97 MPEG4-GENERIC/44100/2
m=video 12666 RTP/AVP 96
a=rtpmap:96 H264/90000

Received sip response:
SIP/2.0 100 Trying
Via: SIP/2.0/TLS 0.0.0.0:5061;branch=z9hG4bKbe4d35839576456d9af0df1ef19cfe7a;rport=60434;received=172.18.218.134
To: <sips:[email protected]>;transport=tls
From: "test" <sip:[email protected]>;tag=CNPYRUXCTX
Call-ID: e7e3611aff604397a66e03d6b1e4f61c
CSeq: 1 INVITE
Content-Length: 0


Received sip response:
SIP/2.0 503 Service unavailable
Via: SIP/2.0/TLS 0.0.0.0:5061;branch=z9hG4bKbe4d35839576456d9af0df1ef19cfe7a;rport=60434;received=172.18.218.134
To: <sips:[email protected]>;transport=tls;tag=521921318
From: "test" <sip:[email protected]>;tag=CNPYRUXCTX
Call-ID: e7e3611aff604397a66e03d6b1e4f61c
CSeq: 1 INVITE
Retry-After: 2
Content-Length: 0
Reason: http;cause=0;text="Request timed-out accessing Locus service: Read timed out"


Sending sip message:
ACK sips:[email protected];transport=tls SIP/2.0
Via: SIP/2.0/TLS 0.0.0.0:5061;branch=z9hG4bKbe4d35839576456d9af0df1ef19cfe7a;rport
To: <sips:[email protected]>;transport=tls;tag=521921318
From: "test" <sip:[email protected]>;tag=CNPYRUXCTX
Call-ID: e7e3611aff604397a66e03d6b1e4f61c
CSeq: 1 ACK
Max-Forwards: 70
Content-Length: 0


Received sip response:
SIP/2.0 503 Service unavailable
Via: SIP/2.0/TLS 0.0.0.0:5061;branch=z9hG4bKbe4d35839576456d9af0df1ef19cfe7a;rport=60434;received=172.18.218.134
To: <sips:[email protected]>;transport=tls;tag=521921318
From: "test" <sip:[email protected]>;tag=CNPYRUXCTX
Call-ID: e7e3611aff604397a66e03d6b1e4f61c
CSeq: 1 INVITE
Retry-After: 2
Content-Length: 0
Reason: http;cause=0;text="Request timed-out accessing Locus service: Read timed out"


Sending sip message:
ACK sips:[email protected];transport=tls SIP/2.0
Via: SIP/2.0/TLS 0.0.0.0:5061;branch=z9hG4bKbe4d35839576456d9af0df1ef19cfe7a;rport
To: <sips:[email protected]>;transport=tls;tag=521921318
From: "test" <sip:[email protected]>;tag=CNPYRUXCTX
Call-ID: e7e3611aff604397a66e03d6b1e4f61c
CSeq: 1 ACK
Max-Forwards: 70
Content-Length: 0


Received sip response:
SIP/2.0 481 call or transaction does not exist
Via: SIP/2.0/TLS 0.0.0.0:5061;branch=z9hG4bKbe4d35839576456d9af0df1ef19cfe7a;rport=60434;received=172.18.218.134
To: <sips:[email protected]>;transport=tls;tag=521921318
From: "test" <sip:[email protected]>;tag=CNPYRUXCTX
Call-ID: e7e3611aff604397a66e03d6b1e4f61c
CSeq: 1 ACK
Content-Length: 0


SIP response received from tcp:13.59.223.3:5061.
SIP/2.0 481 call or transaction does not exist
Via: SIP/2.0/TLS 0.0.0.0:5061;branch=z9hG4bKbe4d35839576456d9af0df1ef19cfe7a;rport=60434;received=172.18.218.134
To: <sips:[email protected]>;transport=tls;tag=521921318
From: "test" <sip:[email protected]>;tag=CNPYRUXCTX
Call-ID: e7e3611aff604397a66e03d6b1e4f61c
CSeq: 1 ACK
Content-Length: 0


Received sip response:
SIP/2.0 481 call or transaction does not exist
Via: SIP/2.0/TLS 0.0.0.0:5061;branch=z9hG4bKbe4d35839576456d9af0df1ef19cfe7a;rport=60434;received=172.18.218.134
To: <sips:[email protected]>;transport=tls;tag=521921318
From: "test" <sip:[email protected]>;tag=CNPYRUXCTX
Call-ID: e7e3611aff604397a66e03d6b1e4f61c
CSeq: 1 ACK
Content-Length: 0


SIP response received from tcp:13.59.223.3:5061.
SIP/2.0 481 call or transaction does not exist
Via: SIP/2.0/TLS 0.0.0.0:5061;branch=z9hG4bKbe4d35839576456d9af0df1ef19cfe7a;rport=60434;received=172.18.218.134
To: <sips:[email protected]>;transport=tls;tag=521921318
From: "test" <sip:[email protected]>;tag=CNPYRUXCTX
Call-ID: e7e3611aff604397a66e03d6b1e4f61c
CSeq: 1 ACK
Content-Length: 0

Normally I'd say it's a bug on Webex side because of the 503 (I'm assuming the Locus service it is referencing is an internal service of theirs). However, I am able to connect with 3rd party sip clients as well as the Python Simple Sip SDK (I haven't been able to get a python environment set up enough to fully understand what it's doing differently).

It seems like there is something off in the way that SipSorcery is performing SIP invites compared to others, but I can't for the life of me figure out what (custom SIP messages I've written are giving the same, and since Webex only uses TLS I can't just do a wireshark capture to figure it out).

Just wanted to bring it to your attention as you are much more knowledgeable in SIP than I.

(I assume the ACK response errors are just because it's not expecting an ACK when a 5xx is returned).

Multiple successful registration

this method

SIPRegistrationUserAgent_RegistrationSuccessful

trigger several times across the calls.

is that normal? expected?

NullReferenceException in SIPUDPTransport

This simple program causes NullReferenceException.

static void Main(string[] args)
{
     var channel = new SIPSorcery.SIP.SIPUDPChannel(new System.Net.IPEndPoint(System.Net.IPAddress.Any, 0));
}

Stack trace:
at SIPSorcery.SIP.SIPUDPChannel.Initialise()
at SIPSorcery.SIP.SIPUDPChannel..ctor(IPEndPoint endPoint)

SRTP support

Hi Aaron.

I've been working on a project for this, and the client has just switched me to a trunk setup that requires TLS and SRTP.

I looked at the source, and it seemed TLS was supported for SIPChannel, but although there were references to things like STRP_SIGNATURE_LENGTH, it also looked like all the related code was commented out.

I'm using 1.5.5.
Could you let me know if SRTP is supported in 1.5.5 or later?
Thanks

Roger

SIP-TCP: not really closing the socket on shutdown

If there is a SIPTCPChannel which a client connected the socket isn't really freed when calling SIPTransport.Shutdown and exiting program.
It takes some time (around 30 sec) until socket is really freed and other application (actually the same but in another instance) can use it again.

I've found that "everybody" has this issue with System.Net.TcpListener and I tried to apply some suggested solutions but nothing worked.

My last work around now is, to do a final read on the NetworkStream in SIPTCPChannel.Close() that blocks until Exception occurs. Only then the Application will exit.

I'm wondering if there is a proper way i haven't discovered yet.
-Listener.Server.Shutdown or Disconnect throws exception
-SocketOption.DontLinger has no noticable effect
-Calling Close() on accepted TcpClients has no noticable effect
-stepping with the debugger through the Net.TcpListener.Close() works for some inexplicable reason but not if run without stepping

Ralf

WebSocket support?

Hi,
I built a basic SIP proxy&registrar using the library in order to test some Windows and mobile SIP UAs. Both the TCP and UDP channels are working fine. (using the SIPTCPChannel and SIPUDPChannel)

I now need to test a SIP UA implemented part of a web application. I was wondering if there is a way for the library to listen to WebSocket connections (wss - secure)? I was not able to see a "SIPWSChannel" implementation (assumed name).

Is there a way of achieving that?

Thanks!

Developer page on wiki difficult to read and copy due to HTML in the code

The code block in the Developers wiki page isn't very readable nor copy-able due to the HTML tags within the code. I cleaned up the HTML and wrapped it in C# code block.

However, atm it's not possible to create PR to wikies so I'm positing the update as an issue.

Simply copy the content below and wrap it in a C# code block as follows (without the indention.)

    ``` C#
    [content goes here]
    ```

(NOTE that I haven't tested if the code runs. I just stripped the HTML)

// ============================================================================
// Description:
// This program provides a minimal example of how to use the SIP Sorcery SIP stack
// to initiate a call to an external user agent. The example sets up the SIP transport
// and then fires off an empty INVITE request to the destination SIP user agent. 
// No media is negotiated and no incoming SIP requests are handled.
//
// Author(s):
// Aaron Clauson
//
// License: 
// This software is licensed under the BSD License http://www.opensource.org/licenses/bsd-license.php
// ============================================================================

using System;
using System.Net;
using SIPSorcery.SIP;
using SIPSorcery.SIP.App;
using SIPSorcery.Sys;

namespace SIPSorcery.Test
{
    class Program
    {
        // The SIP stack internals will bubble log messages up. use this delegate to spit them out to the console.
        private static SIPMonitorLogDelegate _logDelegate = (evt) => {
            if (evt is SIPMonitorConsoleEvent) { 
                Console.WriteLine(((SIPMonitorConsoleEvent)evt).ToConsoleString("*")); 
            }
        };

        static void Main(string[] args)
        {
            try
            {
                Console.WriteLine("SIPSorcery Example:");

                // Set up the SIP transport infrastructure.
                SIPTransport sipTransport = new SIPTransport(SIPDNSManager.ResolveSIPService, new SIPTransactionEngine());
                SIPUDPChannel udpChannel = new SIPUDPChannel(new IPEndPoint(IPAddress.Any, 5060));
                sipTransport.AddSIPChannel(udpChannel);

                // Create a SIP user agent client that can be used to initiate calls to external SIP devices and place a call.
                SIPClientUserAgent uac = new SIPClientUserAgent(sipTransport, null, null, null, _logDelegate);
                SIPCallDescriptor callDescriptor = new SIPCallDescriptor("anonymous", null, "sip:[email protected]:6060", "<sip:[email protected]>", null, null, null, null, SIPCallDirection.Out, "application/sdp", null, null);
                uac.Call(callDescriptor);

                Console.WriteLine("Hit any key to cancel call...");
                Console.Read();

                sipTransport.Shutdown();
            }
            catch(Exception excp)
            {
                Console.WriteLine("Exception Main. " + excp);
            }
            finally
            {
                Console.Write("press any key to exit...");
                Console.ReadLine();
            }
        }
    }
}

Regex.Match vs. Convert.ToInt

Hi Aaron
i ran into an unexpected excpetion while adapting/using code for SIP Notify (SIP Monitor).
There are some occurances in code where strings are checked against regular expressions and Regex.Match returns true and then passed to Convert.ToInt method which fails with "InvalidFormatException".

Solution would be to change either the regular expression pattern to check for whole string is numeric (before: @"\d{1,2}" after: @"^\d{1,2}$") or to use int.TryParse method (preferred, additional check for numeric value necessary if it must be less than 100)

affected file:
-SIPMonitorFilter.cs: ctor(filter), 3x Regex.Match should return false and "else" processing should execute.

Ralf

SIP Proxy and SIP Registrar examples

Hi,
I am looking at building a very basic SIP Proxy and Registrar in .NET and Sipsorcery looks very promising. I looked through the code (SIPSorcery.Servers.Cores) and it seems to support most of the things that I need (actualy more than I need) but I was exactly sure what would be the proper way of using it.

Do you, by any chance, have a basic example showcasing the initilization and some basic interaction with the SIP Registrar (assuming RegistrarCore) and the SIP Proxy (assuming SIPProxyCore).

I was also looking for a nuget package for the Servers side of this project (SIPSorcery.Servers.Cores) but I was not able to find one.

Thank you,
Cristian

Connecting to server

Hello
First Very nice piece of software you have built.

I am trying to connect to swisscom.ch with the sample softphone
I received following settings from my provider

Username (landline number): =>+415XXXXXXXX
Authentication name: [email protected]
Password: passsword
Domain: swisscom.ch
Outbound Proxy: fs1.ims.swisscom.ch

App.config looks like this

<appSettings>
   <add key="STUNServerHostname" value="stun.ekiga.net"/>  
   <add key="SIPUsername" value="XXXXXXXX"/>
   <add key="SIPPassword" value="XXXXXX"/>
   <add key="SIPServer" value="swisscom.ch"/>
   <add key="SIPFromName" value="+415XXXXXXXX"/>
 </appSettings>

I tried to connect like that with minimal modification because of proxy

 var proxy = new SIPEndPoint(new IPEndPoint(Dns.GetHostAddresses("fs1.ims.swisscom.ch")[0],5061));
            _sipRegistrationClient = new SIPRegistrationUserAgent(
                _sipClient.SIPClientTransport,
                proxy, 
                null,
                new SIPURI(m_sipUsername, m_sipServer, null, SIPSchemesEnum.sip, SIPProtocolsEnum.udp),
                m_sipUsername,
                m_sipPassword,
                null,
                m_sipServer,
                new SIPURI(m_sipUsername, _sipClient.SIPClientTransport.GetDefaultSIPEndPoint().GetIPEndPoint().ToString(), null),
                180,
                null,
                null,
                (message) => { logger.Debug(message); });
            _sipRegistrationClient.Start();

but getting som error like

Die Sequenz enthält keine Elemente. => The sequence does not contain any Elements

I think it is important to mention that I have a normal DSL Modem(Router) with an attached additional Router for internal Network.

What am I doing wrong?

Sincerely
Senol Balaban

How to get incoming calls via SoftPhone v2 application?

We have a local Asterisk server with ip 192.168.100.7 that is on our local LAN. The Softphone v2 provided with this API is able to make calls from its 102 username that we specify in app.config. But It is not able to receive any calls on this 102 extension. We are able to make calls from 101 from X-Lite to 102 on another X-Lite. Is there anything else we need to do to receive incoming calls on softphone v2? We want to use this API for just receiving notifications and showing to user.

Any help is greatly appreaciated!

sipsorcery-simpleservers/Proxy Question

Hi,

As per Issue #14, the simple proxy is a very helpful example to start using sipsorcery (so it seems). My goal is for a test endpoint, which acts as a simple registrar and SIP SIMPLE message router.

My question is that when I send a SIP MESSAGE request (to the proxy), it does not fire the SIPTransportRequestReceived() function. Is there something I need to do in order to handle such a request.

Thanks,

Jim

SIPDialogue.Hangup Authentication ?

Hi,

I am facing a problem with the hangout method. My application use a central SIPServer on which i register. Everything works fine. But when I want to hangup the call, I use the SipDialogue.Hangup method and I receive a 401 message from the SIP Server telling me i am not authorize, which is normal because the request does not contains the auths headers. Is that normal that the hangup method does not include the credentials, digest ... like all the other request ?

Regards.

IPv6

Hey Aaron,
I did a lot of work regarding IPV6 in SIPSorcery (parsing, formatting, DNS Resolution)
but only in the 4 libraries i am really using: Core, App, Sys, Net
Before creating a pull request, i wanted to let you know and ask if, by any chance, you did any work for IPv6 yourselves?
And because I did a lot of customization in other places too, merging the code is much work.
So please let me know if you have any interest in my source codes.

Ralf

SIPSorcey.SIP.Core references log4net 1.2.13.0

Although the nuget package claim log4net 2.0.8 or higher dependency, it seems like the log4net reference used in SIPSorcery.SIP.Core 0.2.0.19867 (which ship with nuget package SIPSorcery v1.5.6), is log4net 1.2.13.0 leading to a file loading exception in runtime.

SIPRegistrationUserAgent - Cannot reset expiry after creation

I'll blame the client for this one :)

Set up registration, successful, but device does not receive calls after < 4 minutes, registration happens every 5 minutes.
So I pass in 180 for the expiry interval.
Behaviour does not change.
On investigation, the OK response from the server is setting the Expiry to 300 again.

However, because I can't reset the expiry externally, I can't reset it to a value that will work.

Play Audio File

Hello fellas!
I want to play an audio file in the current call. I'm using the SoftPhone project as reference, and i try to put the "play function" in the RTPManager class, like that:
public void PlayAudio(byte[] buffer) { if (_rtpAudioChannel.RemoteEndPoint != null) { _rtpAudioChannel.SetFrameType(FrameTypesEnum.Audio); MemoryStream memoryStream = new MemoryStream(buffer); int bytesRead = 0; byte[] sample = new byte[160]; bytesRead = memoryStream.Read(sample, 0, 160); while (bytesRead > 0) { _rtpAudioChannel.SendAudioFrame(sample, 160, (int)SDPMediaFormatsEnum.PCMU); bytesRead = memoryStream.Read(sample, 0, 160); } } }
This injects the buffer, but only i hear is dirty.
The file i try to play is attached.
TesteAudioSip.zip

Registration expiry returned not taken into account

Dear Aaron

First of all, I wanted to thank you for the effort you put into this project. It helped me a lot to get into the whole SIP topic.

I have a question regarding the expiry value that is being extracted from the registration response. If only one contact header is present, everything works. If I have two or more registered UAs for the same SIP account, the extraction isn't working as expected. I'm not sure if I mixed things up, but to find the matching expiry value, you're comparing the header contactURI against the sipAccountAOR.

I get the desired behavior if I change:

                    foreach (SIPContactHeader contactHeader in sipResponse.Header.Contact)
                    {
                        if (contactHeader.ContactURI == m_sipAccountAOR)
                        {
                            contactExpires = contactHeader.Expires;
                            break;
                        }
                    }

to:

                    foreach (SIPContactHeader contactHeader in sipResponse.Header.Contact)
                    {
                        if (contactHeader.ContactURI == m_contactURI)
                        {
                            contactExpires = contactHeader.Expires;
                            break;
                        }
                    }

In SIPRegistrationUserAgent.cs

You don't, by accident, know what I'am doing wrong?

Subsequent calls using sipsorcery media DtlsManaged fail.

Hello,
I am using the DtlsManaged and SrtpManaged objects in a server application to handle DTLS and SRTP encryption/decryption for a phone application. In Firefox, the first call works while subsequent calls never appear to finish the handshake. Refreshing/changing the client doesn't help. It seems I must restart the server for a call to be successful. When a call works, the library outputs:

 HANDSHAKE START -   before/accept initialization  - UNKWN
            LOOP -   before/accept initialization  - UNKWN
            LOOP -      SSLv3 read client hello A  - 3RCH_A
            LOOP -     SSLv3 write server hello A  - 3WSH_A
            LOOP -      SSLv3 write certificate A  - 3WSC_A
            LOOP -     SSLv3 write key exchange A  - 3WSKEA
            LOOP - SSLv3 write certificate reques  - 3WCR_A
            LOOP -      SSLv3 write server done A  - 3WSD_A
            LOOP -               SSLv3 flush data  - 3FLUSH
            LOOP - SSLv3 read client certificate   - 3RCC_A
            LOOP - SSLv3 read client key exchange  - 3RCKEA
            LOOP - SSLv3 read certificate verify   - 3RCV_A
            LOOP -          SSLv3 read finished A  - 3RFINA
            LOOP - SSLv3 write change cipher spec  - 3WCCSA
            LOOP -         SSLv3 write finished A  - 3WFINA
            LOOP -               SSLv3 flush data  - 3FLUSH
  HANDSHAKE DONE - SSL negotiation finished succe  - SSLOK

Create srtp server session result 0.
cipher: aes integer counter mode
self-test: passed
cipher: null cipher
self-test: passed
auth func: hmac sha-1 authentication function
self-test: passed
auth func: null authentication function
self-test: passed
debug modules loaded:
srtp (off)
hmac sha-1 (off)
aes icm (off)
alloc (off)
stat test (off)
cipher (off)
auth func (off)
crypto kernel (off)
Create srtp client session result 0.

Subsequent calls only output, without errors:

 HANDSHAKE START -   before/accept initialization  - UNKWN
            LOOP -   before/accept initialization  - UNKWN
            LOOP -      SSLv3 read client hello A  - 3RCH_A
            LOOP -     SSLv3 write server hello A  - 3WSH_A
            LOOP -      SSLv3 write certificate A  - 3WSC_A
            LOOP -     SSLv3 write key exchange A  - 3WSKEA
            LOOP - SSLv3 write certificate reques  - 3WCR_A
            LOOP -      SSLv3 write server done A  - 3WSD_A
            LOOP -               SSLv3 flush data  - 3FLUSH

Also, I never get a successful handshake in Chrome, even if it is the first call. I always get the same output as the failed subsequent calls. I'm not sure if this is a problem with the library, or if I'm using incorrectly. I followed the pattern in one of the sipsorcery media samples.

SIPRegistrationUserAgent does not stop sometimes

I think based on the logging I can get

Calling Stop logs at line 180 and at line 166
in between that I get a "DisposedObjectException" in SendInitialRegister -> SIPUDPChannel.Send

I also get (only when this happens) "DNSManager lookup queued" followed by "DNSManager timed out waiting for the DNS resolver"

CodeBase exception in AppState.cs

            string localPath = new Uri(System.Reflection.Assembly.GetExecutingAssembly().CodeBase).LocalPath;
            CurrentDirectory = Regex.Replace(Path.GetDirectoryName(localPath), @"^file:\\", ""); // There's undoubtedly a better way!

However, also seems to be the "mscorlib" path so you might want GetEntryAssembly instead

SIPSorcery.SIP.SIPTransport.Shutdown leaves connected sockets in WAIT state (v1.5.6)

When I have an established connection between endpoints, those will stay in a WAIT_TIME state on the related socket, when SIPTransport.Shutdown has been initiated.

Log output:
Starting logging initialisation.
137 [5] DEBUG sipsorcery (null) - Logging initialised.
318 [5] DEBUG sipsorcery.sip (null) - SIP TCP Channel listener created 1.1.1.1:47002.
335 [siptcp-47002] DEBUG sipsorcery.sip (null) - SIPTCPChannel socket on tcp:1.1.1.1:47002 accept connections thread started.
1104 [18] DEBUG sipsorcery.sip (null) - Attempting to establish TCP connection to 1.1.1.2:5060.
1117 [11] DEBUG sipsorcery.sip (null) - Established TCP connection to 1.1.1.2:5060.
41353 [18] DEBUG sipsorcery.sip (null) - Closing SIP TCP Channel tcp:1.1.1.1:47002.
41375 [siptcp-47002] WARN sipsorcery.sip (null) - Exception SIPTCPChannel accepting socket (System.Net.Sockets.SocketException). A blocking operation was interrupted by a call to WSACancelBlockingCall
41377 [20] WARN sipsorcery.sip (null) - Exception SIPTCPChannel ReceiveCallback. Cannot access a disposed object. Object name: 'System.Net.Sockets.NetworkStream'.
41376 [siptransport-receive] WARN sipsorcery.sip (null) - SIPTransport process received messsages thread stopped.
41376 [18] DEBUG sipsorcery.sip (null) - SIPTransport Shutdown Complete.
41397 [siptcp-47002] DEBUG sipsorcery.sip (null) - SIPTCPChannel socket on tcp:1.1.1.1:47002 listening halted.
41417 [20] DEBUG sipsorcery.sip (null) - TCP socket from 1.1.1.2:5060 disconnected.

Even tho the last line claims that TCP socket from 1.1.1.2:5060 has been disconnect, a netstat shows that this is not the case, or at least, that the connection is in a TIME_WAIT state, which should be avoided.

By looking at the SIPSorcery code, I cannot see why this happens, as the TcpListener is shut down first, followed by a TcpClient shutdown (SocketShutdown.Both).

NullReference Exception in SIPClientUserAgent.cs

m_Logger.Debug("RTCC reservation was reallocated from CDR " + originalCallTransaction.CDR.CDRId + " to " + ServerTransaction.CDR.CDRId + " for owner " + Owner + ".");

SIPClientUserAgent.cs

originalCallTransaction.CDR may sometimes be null

Null Reference Error in ClientUserAgent

If SIPClient has not completed InitialiseSIP before SIPClientUserAgent is created, you can end up passing in NULL for sipTransport.
Then later when a call starts, you get a Null Reference error elsewhere.
I'd suggest adding a null check into the constructor so you get an informative error back in the right place.

public SIPClientUserAgent(
SIPTransport sipTransport,
SIPEndPoint outboundProxy,
string owner,
string adminMemberId,
SIPMonitorLogDelegate logDelegate
)
{
m_sipTransport = sipTransport;

net core are support?

Please mark it issue as question.

I am interested in the question, can this library work with net core 2.2 cross-platform? Thank.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.