Skip to content

ServerCallCancelled is not triggered #1478

@juanaschieri-source

Description

@juanaschieri-source

Hello.
I am attempting to place calls from my voip phone to a mobile network phone. I have been able to place the call and receive a dtmf input from it. I can determine when the person answers and when they hang up the phone. However when i try to set a callback for ServerCallCanceled it never gets triggered. As far as i understand it should get triggered when a call is made and the person receiving it, ends the call before it times out and without answering. Instead of the ServerCallCancelled being executed, when doing this, it either executes the answer callback on some phones, or doesn't execute any callback and immediately places another call on other phones.

I add here a simplified version of my code

internal class Program
{
    private static int SIP_LISTEN_PORT = 5060;
    const string PHONE_NUMBER = "MyPhoneNumber";
    const string SIP_DOMAIN = "my.zipdomain.com";
    const string SIP_USER = "userId";
    const string SIP_PASS = "pass";

    static async Task Main(string[] args)
    {
        string CALL_DESTINATION = $"sip:{PHONE_NUMBER}@{SIP_DOMAIN}:{SIP_LISTEN_PORT};transport=tcp";

        SIPTransport sipTransport = new SIPTransport();

        sipTransport.AddSIPChannel(
            new SIPTCPChannel(new IPEndPoint(IPAddress.Any, SIP_LISTEN_PORT))
        );

        var ua = new SIPUserAgent(sipTransport, null, true);
        ua.ServerCallCancelled += (uas, req) => Console.WriteLine($"Salio {uas.CallDestination} Trying: {req.Body} {req.StatusLine}.");
        var rtpSession = MinimalCreateRtpSession(ua, SIP_LISTEN_PORT);
        var callResult = await ua.Call(CALL_DESTINATION, SIP_USER, SIP_PASS, rtpSession);

        var keyProps = Console.ReadKey();
    }

    private static VoIPMediaSession MinimalCreateRtpSession(SIPUserAgent ua, int bindPort)
    {
        var audioSource = AudioSourcesEnum.None;
        AudioExtrasSource audioExtrasSource = new AudioExtrasSource(new AudioEncoder(), new AudioSourceOptions { AudioSource = audioSource });
        var rtpAudioSession = new VoIPMediaSession(new MediaEndPoints { AudioSource = audioExtrasSource }, bindPort: bindPort);

        return rtpAudioSession;
    }
}

Thanks in advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions