Configuration API > BS2_SetVoipConfigExt


[+ 2.8.3] BioStation 3 확장형 VoIP 설정을 저장합니다.
BS2VoipConfig와 비교하여 outbound proxy의 지정이나, 음량 설정과 같은 다양한 설정이 추가되었습니다.

함수

#include "BS_API.h"
 
int BS2_SetVoipConfigExt(void* context, uint32_t deviceId, const BS2VoipConfigExt* config);

파라미터

  • [In] context : Context
  • [In] deviceId : 장치 식별자
  • [In] config : VoIP 설정 정보 포인터

반환값

성공적으로 수행될 경우 BS_SDK_SUCCESS를 반환하고, 에러가 발생할 경우 상응하는 에러 코드를 반환합니다.

샘플코드(C++)

sample_setvoipconfigext.cpp
BS2VoipConfigExt config = { 0, };
 
config.enabled = true;
config.useOutboundProxy = false;
config.registrationDuration = 300;
 
string ipAddr = "192.168.0.9";
memcpy(config.address, ipAddr.c_str(), ipAddr.size());
config.port = 5060;
config.volume.speaker = 50;
config.volume.mic = 50;
 
string sipID = "myAccount";
memcpy(config.id, sipID.c_str(), sipID.size());
string sipPW = "myPassword";
memcpy(config.password, sipPW.c_str(), sipPW.size());
string authCode = "1234";
memcpy(config.authorizationCode, authCode.c_str(), authCode.size());
 
config.exitButton = '0';  // keypad 0
config.showExtensionNumber = true;
config.numPhoneBook = 2;
 
string phoneNum = "600";
memcpy(config.phonebook[0].phoneNumber, phoneNum.c_str(), phoneNum.size());
string phoneDesc = "LB James";
memcpy(config.phonebook[0].description, phoneDesc.c_str(), phoneDesc.size());
phoneNum = "601";
memcpy(config.phonebook[1].phoneNumber, phoneNum.c_str(), phoneNum.size());
phoneDesc = "C Kershaw";
memcpy(config.phonebook[1].description, phoneDesc.c_str(), phoneDesc.size());
 
int sdkResult = BS2_SetVoipConfigExt(context, id, &config);
if (BS_SDK_SUCCESS != sdkResult)
	printf("BS2_SetVoipConfigExt call failed: %d", sdkResult);

샘플코드(C#)

sample_setvoipconfigext.cs
BS2VoipConfigExt config = Util.AllocateStructure<BS2VoipConfigExt>();
 
config.enabled = Convert.ToByte(1);
config.useOutboundProxy = Convert.ToByte(0);
config.registrationDuration = 300;
 
string strIpAddr = "192.168.0.9";
byte[] arrIpAddr = Encoding.UTF8.GetBytes(strIpAddr);
Array.Clear(config.address, 0, BS2Environment.BS2_URL_SIZE);
Array.Copy(arrIpAddr, 0, config.address, 0, arrIpAddr.Length);
config.port = 5060;
 
config.volume.speaker = 50;
config.volume.mic = 50;
 
string strSIPID = "myAccount";
byte[] arrSIPID = Encoding.UTF8.GetBytes(strSIPID);
Array.Clear(config.id, 0, BS2Environment.BS2_USER_ID_SIZE);
Array.Copy(arrSIPID, 0, config.id, 0, arrSIPID.Length);
 
string strSIPPW = "myPassword";
byte[] arrSIPPW = Encoding.UTF8.GetBytes(strSIPPW);
Array.Clear(config.password, 0, BS2Environment.BS2_USER_ID_SIZE);
Array.Copy(arrSIPPW, 0, config.password, 0, arrSIPPW.Length);
 
string strAuthCode = "1234";
byte[] arrAuthCode = Encoding.UTF8.GetBytes(strAuthCode);
Array.Clear(config.authorizationCode, 0, BS2Environment.BS2_USER_ID_SIZE);
Array.Copy(arrAuthCode, 0, config.authorizationCode, 0, arrAuthCode.Length);
 
config.exitButton = Convert.ToByte('0');  // keypad 0
config.showExtensionNumber = Convert.ToByte(true);
config.numPhoneBook = 2;
 
string strPhoneNum = "600";
byte[] arrPhoneNum = Encoding.UTF8.GetBytes(strPhoneNum);
Array.Clear(config.phonebook[0].phoneNumber, 0, BS2Environment.BS2_USER_ID_SIZE);
Array.Copy(arrPhoneNum, 0, config.phonebook[0].phoneNumber, 0, arrPhoneNum.Length);
string strPhoneDesc = "LB James";
byte[] arrPhoneDesc = Encoding.UTF8.GetBytes(strPhoneDesc);
Array.Clear(config.phonebook[0].description, 0, BS2Environment.BS2_VOIP_MAX_DESCRIPTION_LEN_EXT);
Array.Copy(arrPhoneDesc, 0, config.phonebook[0].description, 0, arrPhoneDesc.Length);
strPhoneNum = "601";
arrPhoneNum = Encoding.UTF8.GetBytes(strPhoneNum);
Array.Clear(config.phonebook[1].phoneNumber, 0, BS2Environment.BS2_USER_ID_SIZE);
Array.Copy(arrPhoneNum, 0, config.phonebook[1].phoneNumber, 0, arrPhoneNum.Length);
strPhoneDesc = "C Kershaw";
arrPhoneDesc = Encoding.UTF8.GetBytes(strPhoneDesc);
Array.Clear(config.phonebook[1].description, 0, BS2Environment.BS2_VOIP_MAX_DESCRIPTION_LEN_EXT);
Array.Copy(arrPhoneDesc, 0, config.phonebook[1].description, 0, arrPhoneDesc.Length);
 
BS2ErrorCode result = (BS2ErrorCode)API.BS2_SetVoipConfigExt(sdkContext, deviceID, ref config);
if (result != BS2ErrorCode.BS_SDK_SUCCESS)
{
	Console.WriteLine("Got error({0}).", result);
}