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

Unable to dial "short codes" #103

Open
rndthoughts opened this issue Jun 13, 2019 · 14 comments
Open

Unable to dial "short codes" #103

rndthoughts opened this issue Jun 13, 2019 · 14 comments
Assignees
Labels

Comments

@rndthoughts
Copy link

rndthoughts commented Jun 13, 2019

Describe the bug

My SIP server uses shortcodes to activate night service, pickup calls ringing elsewhere but if i attempt to call "MakeCall" with the short code (e.g. "**20") I get - "Choice stack is empty. Unable to fallback to another state". I am assuming it's because the asterisks are the problem, but how do i get the short code transmitted?

If it's because i need to send Dtmf codes, how do I open the line without making a call to a specific number so that they can be sent?

To Reproduce
Steps to reproduce the behavior:

_userAgent.CallManager.MakeCall(x => x.To("**20").At(_serverName).Through("5060").From(_userAgent.AccountManager.Accounts.First()).Call());

Expected behavior
Short code executes command on server and user either hears response read back (e.g. "Night mode activated" or call is transferred.

Environment (please complete the following information):

  • OS: Windows 10
  • Internet (TCP/IP)
  • Latest Version

App configuration (please complete the following information):

<sipua srtp="Disabled" secureSignaling="0" logMessages="true" logLevel="5" traceAndDebug="false" autoAnswer="false" autoRecording="false" autoConference="false" maxCalls="5">
    <sipTransport type="udp" Port="5080" />
    <networkSettings natInSDP="true" forceLooseRoute="false">
      <turn enabled="false" server="" type="udp" userName="" password="" realm="" />
      <ice enabled="false" noRTCP="false" />
    </networkSettings>
    <media isVADEnabled="true" />
  </sipua>
@siniypin siniypin self-assigned this Jun 13, 2019
@siniypin
Copy link
Collaborator

Hi Steve,

thank you for submitting this issue. I guess the SIP parser I wrote doesn't support SIP BNF grammar at full. In particular, it disregards a mark definition that can be used in a username: https://tools.ietf.org/html/rfc3261#section-25.1.
I'll have a look at it, but you can also check to see, if there is an easy fix to it (cause I can not guarantee that I'll have time to do so soon) here: https://github.com/siniypin/pjsip4net/blob/master/pjsip4net.Core/Utils/SipUriParser.cs#L35

In case you fix it before I do, kindly send a pull request back.

@siniypin siniypin added the bug label Jun 13, 2019
@siniypin
Copy link
Collaborator

@rndthoughts
Copy link
Author

Thanks - I'll see what I can do!

@rndthoughts
Copy link
Author

Would it be acceptable if I just extend _domainSpecialCharacters to include the other marks on the line below?

https://github.com/siniypin/pjsip4net/blob/master/pjsip4net.Core/Utils/SipUriParser.cs#L44

@rndthoughts
Copy link
Author

OK - that didn't work. If i've got this correct, I think when the state machine transitions from //column to extension it's only accepting numbers and needs to accept numbers and _domainSpecialCharacters

https://github.com/siniypin/pjsip4net/blob/master/pjsip4net.Core/Utils/SipUriParser.cs#L205

@siniypin
Copy link
Collaborator

That too, you're right!

@siniypin
Copy link
Collaborator

siniypin commented Jun 13, 2019

And would you mind adding a unit test for this change here: https://github.com/siniypin/pjsip4net/blob/master/Tests/Unit/pjsip4net.Tests/given_a_sip_uri_parser.cs?

@siniypin
Copy link
Collaborator

You need to run build.bat https://github.com/siniypin/pjsip4net#examples

@rndthoughts
Copy link
Author

I've implemented the code changes on my local version but I think rather than "dialling" them as a number we need to "open" an empty line and send them as Dtmf tones. I can only do this by calling a destination but in this case I need to just send them to directly to the server. How do I get a "dial tone" when I don't have a destination number to call?

(What I'm trying to do is simulate picking up the handset, hearing the dial tone and typing **20)

@siniypin
Copy link
Collaborator

Hm, I suspect that that will not work in general. In a dialplan on your server you'd have to define a route for such calls, cause it has to know that you're going to send shortcodes as DTMFs to it upfront. If that is what happening there, then you have to have an extension to call to.

Maybe check once again what exactly happens on your server when it receives a call with an extension with a shortcode.

Did dialing a number with ** in front not work for you?

@rndthoughts
Copy link
Author

Not currently - I dialed the number and I move instantly from "Calling" to "Disconnected". If it worked, I would assume the server would have pushed the call into one of my lines which I could subsequently pickup or it would have connected the call to the open line?

@siniypin
Copy link
Collaborator

Have you checked your server logs? BTW, would you mind submitting a Pull Request back anyway?

@rndthoughts
Copy link
Author

I'll take a look at the logs - no problem with the PR, I'll do it as soon as i can.

@siniypin
Copy link
Collaborator

ping! friendly reminder about a PR

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

No branches or pull requests

2 participants