Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
83f8b5fc
Commit
83f8b5fc
authored
Sep 27, 2010
by
Simon Morlat
Browse files
improve early media: add an api to set a ringback tone.
parent
69a85452
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
50 additions
and
13 deletions
+50
-13
console/commands.c
console/commands.c
+19
-2
coreapi/callbacks.c
coreapi/callbacks.c
+4
-4
coreapi/linphonecall.c
coreapi/linphonecall.c
+3
-7
coreapi/linphonecore.c
coreapi/linphonecore.c
+21
-0
coreapi/linphonecore.h
coreapi/linphonecore.h
+2
-0
coreapi/private.h
coreapi/private.h
+1
-0
No files found.
console/commands.c
View file @
83f8b5fc
...
...
@@ -95,6 +95,7 @@ static int lpc_cmd_video_window(LinphoneCore *lc, char *args);
#endif
static
int
lpc_cmd_states
(
LinphoneCore
*
lc
,
char
*
args
);
static
int
lpc_cmd_identify
(
LinphoneCore
*
lc
,
char
*
args
);
static
int
lpc_cmd_ringback
(
LinphoneCore
*
lc
,
char
*
args
);
/* Command handler helpers */
static
void
linphonec_proxy_add
(
LinphoneCore
*
lc
);
...
...
@@ -302,6 +303,10 @@ static LPC_COMMAND advanced_commands[] = {
"'identify'
\t
: returns remote user-agent string for current call.
\n
"
"'identify <id>'
\t
: returns remote user-agent string for call with supplied id.
\n
"
},
{
"ringback"
,
lpc_cmd_ringback
,
"Specifies a ringback tone to be played to remote end during incoming calls"
,
"'ringback <path of mono .wav file>'
\t
: Specifies a ringback tone to be played to remote end during incoming calls
\n
"
"'ringback disable'
\t
: Disable playing of ringback tone to callers
\n
"
},
{
NULL
,
NULL
,
NULL
,
NULL
}
};
...
...
@@ -650,7 +655,7 @@ static int
lpc_cmd_terminate
(
LinphoneCore
*
lc
,
char
*
args
)
{
if
(
linphone_core_get_calls
(
lc
)
==
NULL
){
linphonec_out
(
"No active calls"
);
linphonec_out
(
"No active calls
\n
"
);
return
1
;
}
if
(
!
args
)
...
...
@@ -671,7 +676,7 @@ lpc_cmd_terminate(LinphoneCore *lc, char *args)
LinphoneCall
*
call
=
linphonec_get_call
(
id
);
if
(
call
){
if
(
linphone_core_terminate_call
(
lc
,
call
)
==-
1
){
linphonec_out
(
"Could not stop the call with id %li"
,
id
);
linphonec_out
(
"Could not stop the call with id %li
\n
"
,
id
);
}
}
else
return
0
;
return
1
;
...
...
@@ -2357,6 +2362,18 @@ static int lpc_cmd_identify(LinphoneCore *lc, char *args){
return
1
;
}
static
int
lpc_cmd_ringback
(
LinphoneCore
*
lc
,
char
*
args
){
if
(
!
args
)
return
0
;
if
(
strcmp
(
args
,
"disable"
)
==
0
){
linphone_core_set_remote_ringback_tone
(
lc
,
NULL
);
linphonec_out
(
"Disabling ringback tone.
\n
"
);
return
1
;
}
linphone_core_set_remote_ringback_tone
(
lc
,
args
);
linphonec_out
(
"Using %s as ringback tone to be played to callers."
,
args
);
return
1
;
}
/***************************************************************************
*
* Command table management funx
...
...
coreapi/callbacks.c
View file @
83f8b5fc
...
...
@@ -42,8 +42,8 @@ static void call_received(SalOp *h){
const
char
*
from
,
*
to
;
char
*
tmp
;
LinphoneAddress
*
from_parsed
;
bool_t
early_media
=
lp_config_get_int
(
lc
->
config
,
"sip"
,
"send_early_media"
,
0
);
const
char
*
early_media
=
linphone_core_get_remote_ringback_tone
(
lc
);
/* first check if we can answer successfully to this invite */
if
(
lc
->
presence_mode
==
LinphoneStatusBusy
||
lc
->
presence_mode
==
LinphoneStatusOffline
||
...
...
@@ -118,10 +118,10 @@ static void call_received(SalOp *h){
}
else
{
/*TODO : play a tone within the context of the current call */
}
sal_call_notify_ringing
(
h
,
early_media
);
sal_call_notify_ringing
(
h
,
early_media
!=
NULL
);
#if !(__IPHONE_OS_VERSION_MIN_REQUIRED >= 40000)
linphone_call_init_media_streams
(
call
);
if
(
early_media
){
if
(
early_media
!=
NULL
){
linphone_call_start_early_media
(
call
);
}
#endif
...
...
coreapi/linphonecall.c
View file @
83f8b5fc
...
...
@@ -710,14 +710,8 @@ static RtpProfile *make_profile(LinphoneCore *lc, const SalMediaDescription *md,
}
static
void
setup_ring_player
(
LinphoneCore
*
lc
,
LinphoneCall
*
call
){
const
char
*
ringfile
=
lc
->
sound_conf
.
remote_ring
;
int
pause_time
=
3000
;
if
(
lc
->
play_file
!=
NULL
){
audio_stream_play
(
call
->
audiostream
,
lc
->
play_file
);
pause_time
=
0
;
}
else
{
audio_stream_play
(
call
->
audiostream
,
ringfile
);
}
audio_stream_play
(
call
->
audiostream
,
lc
->
sound_conf
.
ringback_tone
);
ms_filter_call_method
(
call
->
audiostream
->
soundread
,
MS_FILE_PLAYER_LOOP
,
&
pause_time
);
}
...
...
@@ -764,6 +758,8 @@ static void _linphone_call_start_media_streams(LinphoneCall *call, bool_t send_e
playcard
=
NULL
;
captcard
=
NULL
;
recfile
=
NULL
;
if
(
send_early_media
)
playfile
=
NULL
;
}
/*if playfile are supplied don't use soundcards*/
if
(
lc
->
use_files
)
{
...
...
coreapi/linphonecore.c
View file @
83f8b5fc
...
...
@@ -467,6 +467,8 @@ static void sound_config_read(LinphoneCore *lc)
gain
=
lp_config_get_float
(
lc
->
config
,
"sound"
,
"playback_gain_db"
,
0
);
linphone_core_set_playback_gain_db
(
lc
,
gain
);
linphone_core_set_remote_ringback_tone
(
lc
,
lp_config_get_string
(
lc
->
config
,
"sound"
,
"ringback_tone"
,
NULL
));
}
static
void
sip_config_read
(
LinphoneCore
*
lc
)
...
...
@@ -3868,6 +3870,25 @@ int linphone_core_del_call( LinphoneCore *lc, LinphoneCall *call)
return
0
;
}
/**
* Specifiies a ring back tone to be played to far end during incoming calls.
**/
void
linphone_core_set_remote_ringback_tone
(
LinphoneCore
*
lc
,
const
char
*
file
){
if
(
lc
->
sound_conf
.
ringback_tone
){
ms_free
(
lc
->
sound_conf
.
ringback_tone
);
lc
->
sound_conf
.
ringback_tone
=
NULL
;
}
if
(
file
)
lc
->
sound_conf
.
ringback_tone
=
ms_strdup
(
file
);
}
/**
* Returns the ring back tone played to far end during incoming calls.
**/
const
char
*
linphone_core_get_remote_ringback_tone
(
const
LinphoneCore
*
lc
){
return
lc
->
sound_conf
.
ringback_tone
;
}
static
PayloadType
*
find_payload_type_from_list
(
const
char
*
type
,
int
rate
,
const
MSList
*
from
)
{
const
MSList
*
elem
;
for
(
elem
=
from
;
elem
!=
NULL
;
elem
=
elem
->
next
){
...
...
coreapi/linphonecore.h
View file @
83f8b5fc
...
...
@@ -746,6 +746,8 @@ void linphone_core_set_ring(LinphoneCore *lc, const char *path);
const
char
*
linphone_core_get_ring
(
const
LinphoneCore
*
lc
);
void
linphone_core_set_ringback
(
LinphoneCore
*
lc
,
const
char
*
path
);
const
char
*
linphone_core_get_ringback
(
const
LinphoneCore
*
lc
);
void
linphone_core_set_remote_ringback_tone
(
LinphoneCore
*
lc
,
const
char
*
);
const
char
*
linphone_core_get_remote_ringback_tone
(
const
LinphoneCore
*
lc
);
int
linphone_core_preview_ring
(
LinphoneCore
*
lc
,
const
char
*
ring
,
LinphoneCoreCbFunc
func
,
void
*
userdata
);
void
linphone_core_enable_echo_cancellation
(
LinphoneCore
*
lc
,
bool_t
val
);
bool_t
linphone_core_echo_cancellation_enabled
(
LinphoneCore
*
lc
);
...
...
coreapi/private.h
View file @
83f8b5fc
...
...
@@ -320,6 +320,7 @@ typedef struct sound_config
char
source
;
char
*
local_ring
;
char
*
remote_ring
;
char
*
ringback_tone
;
bool_t
ec
;
bool_t
ea
;
bool_t
agc
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment