new api function: audio_codecs
This commit is contained in:
@@ -1146,6 +1146,27 @@ Java_com_tutpro_baresip_Api_call_1unhold(JNIEnv *env, jobject thiz, jstring java
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JNIEXPORT jstring JNICALL
|
||||||
|
Java_com_tutpro_baresip_Api_call_1audio_1codecs(JNIEnv *env, jobject thiz, jstring javaCall) {
|
||||||
|
const char *native_call = (*env)->GetStringUTFChars(env, javaCall, 0);
|
||||||
|
(*env)->ReleaseStringUTFChars(env, javaCall, native_call);
|
||||||
|
struct call *call = (struct call *) strtoul(native_call, NULL, 10);
|
||||||
|
const struct aucodec *tx = audio_codec(call_audio(call), true);
|
||||||
|
const struct aucodec *rx = audio_codec(call_audio(call), false);
|
||||||
|
char codec_buf[256];
|
||||||
|
char *start = &(codec_buf[0]);
|
||||||
|
unsigned int left = sizeof codec_buf;
|
||||||
|
int len = -1;
|
||||||
|
if (tx && rx)
|
||||||
|
len = re_snprintf(start, left, "%s/%u/%u,%s/%u/%u", tx->name, tx->srate, tx->ch,
|
||||||
|
rx->name, rx->srate, rx->ch);
|
||||||
|
if (len == -1) {
|
||||||
|
LOGE("failed to get call audio codecs\n");
|
||||||
|
codec_buf[0] = '\0';
|
||||||
|
}
|
||||||
|
return (*env)->NewStringUTF(env, codec_buf);
|
||||||
|
}
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL
|
JNIEXPORT jint JNICALL
|
||||||
Java_com_tutpro_baresip_Api_message_1send(JNIEnv *env, jobject thiz, jstring javaUA,
|
Java_com_tutpro_baresip_Api_message_1send(JNIEnv *env, jobject thiz, jstring javaUA,
|
||||||
jstring javaPeer, jstring javaMsg, jstring javaTime) {
|
jstring javaPeer, jstring javaMsg, jstring javaTime) {
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ object Api {
|
|||||||
external fun call_notify_sipfrag(callp: String, code: Int, reason: String)
|
external fun call_notify_sipfrag(callp: String, code: Int, reason: String)
|
||||||
external fun call_start_audio(callp: String)
|
external fun call_start_audio(callp: String)
|
||||||
external fun call_stop_audio(callp: String)
|
external fun call_stop_audio(callp: String)
|
||||||
|
external fun call_audio_codecs(callp: String): String
|
||||||
external fun message_send(uap: String, peer_uri: String, message: String, time: String): Int
|
external fun message_send(uap: String, peer_uri: String, message: String, time: String): Int
|
||||||
external fun reload_config(): Int
|
external fun reload_config(): Int
|
||||||
external fun cmd_exec(cmd: String): Int
|
external fun cmd_exec(cmd: String): Int
|
||||||
|
|||||||
Reference in New Issue
Block a user