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

ua,call: add API for rejecting incoming call #57

Merged
merged 6 commits into from
Dec 2, 2024

Conversation

cspiel1
Copy link
Collaborator

@cspiel1 cspiel1 commented Nov 22, 2024

Implements: baresip/baresip#3207

config

The redirect module has to be loaded first, at least before module menu because it stops the UA_EVENT_SIPSESS_CONN event if a redirect is set by the user.

# Application Modules

module_app		redirect.so
...
module_app		menu.so

@cspiel1 cspiel1 force-pushed the module_redirect branch 2 times, most recently from eec1d63 to e7a584e Compare November 22, 2024 17:27
@cspiel1 cspiel1 marked this pull request as ready for review November 26, 2024 09:53
@cspiel1
Copy link
Collaborator Author

cspiel1 commented Nov 26, 2024

Did some basic tests.

@cspiel1
Copy link
Collaborator Author

cspiel1 commented Nov 27, 2024

@zucher please could you test this? Does it fit to your needs?

@zucher
Copy link

zucher commented Nov 27, 2024

@cspiel1 sure, thank you, I take a look tomorrow.

@zucher
Copy link

zucher commented Nov 27, 2024

I just take a look shortly on the code, as static setting it's seems fine, but in my currently wish , I expect to manage the hangup rejection on demand dynamically according to the incoming number, so in such case static configuration doesn't fit.
The dynamic rejection depends on external CRM/DB, so managing asynchronously on event ( tcp /mqtt,dbus/...) seems the most appropriated.

@cspiel1
Copy link
Collaborator Author

cspiel1 commented Nov 28, 2024

This sounds useful in general. So, I'll try to find a solution for this. With an async query to the app currently I see the problem, that the answer has to come very quickly from the app in order to avoid sending of SIP retries. But I'll check the details for the timing.

@zucher
Copy link

zucher commented Nov 28, 2024

I manage on my side some test to reject on SIP RINGING, and it's working, so the delay seems not an issue, and the divert on microsip use also the same method on ringing state.

@zucher
Copy link

zucher commented Nov 28, 2024

but this means not treating the rejection/hhangup at application side but directly into baresip lib due to session depends, not accessible ouside the lib.

@cspiel1
Copy link
Collaborator Author

cspiel1 commented Nov 28, 2024

Working on an API function:

void call_reject(struct call *call, uint16_t scode, const char *reason, const char *fmt, ...);

/* usage example */
	call_reject(call, scode, reason,
	      "Contact: <%r>%s\r\n"
	      "Diversion: <%s>%r\r\n"
	      "Content-Length: 0\r\n\r\n",
	      &params.contact,
	      expstr,
	      account_aor(ua_account(ua)),
	      &params.divparams);

Edit: Maybe the name will change.

@zucher
Copy link

zucher commented Nov 28, 2024

That's sound good, I'm working with callid's to be able to manage multiple incoming calls at a time. The integration of this function into an app becomes simpler
👍

@cspiel1
Copy link
Collaborator Author

cspiel1 commented Nov 28, 2024

Here is what we need in baresip core: baresip/baresip#3228.

The commit that follows add a new command the is able to reject a call with given Contact, expiry, Diversion parameters, scode and reason.

I have to change the title of this PR in order to switch to the right baresip branch.

@cspiel1 cspiel1 changed the title add module redirect ua,call: add API for rejecting incoming call Nov 28, 2024
@zucher
Copy link

zucher commented Nov 29, 2024

@cspiel1 , Thank you that's working very fine !

@cspiel1
Copy link
Collaborator Author

cspiel1 commented Nov 29, 2024

You're welcome!

In order to keep menu/dynamic_menu.c in the baresip repo small and simple I suggest to keep the command call_redirect here in this baresip-apps module. Until otherwise requested.

I suggest also to keep the other commands uaredirect_add, uaredirect_clear and uaredirect_debug. They provide the early reject of a SIP INVITE. With early I mean that no call object, or SIP session/dialog is allocated and ringing is not started.

@cspiel1 cspiel1 merged commit bcecead into baresip:main Dec 2, 2024
6 checks passed
@cspiel1 cspiel1 deleted the module_redirect branch December 2, 2024 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants