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

Updated CTSoftPhone to support dtmf inputs via pjsua #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Source/CTSoftPhone.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ typedef NS_ENUM(int, CTSoftPhoneCallState) {
- (void)unmute;
- (void)speakeron;
- (void)speakeroff;
- (void)dtmf:(NSString*_Nonnull) digits;

@end

17 changes: 17 additions & 0 deletions Source/CTSoftPhone.m
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,23 @@ - (void)handleIpChange:(CTSoftPhoneTransportType)transport {
}];
}

- (void)dtmf:(NSString*) digits {
@try {
[self runAsync: ^{
[self registerThread];
pjsua_call_send_dtmf_param param;
pjsua_call_send_dtmf_param_default(&param);
param.digits = pj_str((char *) [digits UTF8String]);
param.method = PJSUA_DTMF_METHOD_SIP_INFO;
pjsua_call_send_dtmf(callId, &param);
CTSoftPhone_Log(CTSoftPhoneLogInfo, "dtmf input successfully sent to asterisk");
}];
}
@catch (NSException *exception) {
CTSoftPhone_Log(CTSoftPhoneLogDebug, "unable to send dtmf input to asterisk: %@", exception);
}
}

/**
called by user to shutdown the service.
*/
Expand Down