차이
문서의 선택한 두 판 사이의 차이를 보여줍니다.
양쪽 이전 판 이전 판 다음 판 | 이전 판 | ||
ko:bs2_setvoipconfigext [2022/08/24 19:32] kkshin |
ko:bs2_setvoipconfigext [2024/05/28 18:44] kkshin |
||
---|---|---|---|
줄 5: | 줄 5: | ||
===== BS2_SetVoipConfigExt ===== | ===== BS2_SetVoipConfigExt ===== | ||
- | [+ 2.8.3] ''BioStation 3'' 확장형 VoIP 설정을 저장합니다. \\ | + | [+ 2.8.3] 확장형 VoIP 설정을 저장합니다. \\ |
[[configuration_api#BS2VoipConfig]]와 비교하여 outbound proxy의 지정이나, 음량 설정과 같은 다양한 설정이 추가되었습니다. \\ | [[configuration_api#BS2VoipConfig]]와 비교하여 outbound proxy의 지정이나, 음량 설정과 같은 다양한 설정이 추가되었습니다. \\ | ||
==== 함수 ==== | ==== 함수 ==== | ||
줄 23: | 줄 23: | ||
==== 반환값 ==== | ==== 반환값 ==== | ||
성공적으로 수행될 경우 ''BS_SDK_SUCCESS''를 반환하고, 에러가 발생할 경우 상응하는 에러 코드를 반환합니다. | 성공적으로 수행될 경우 ''BS_SDK_SUCCESS''를 반환하고, 에러가 발생할 경우 상응하는 에러 코드를 반환합니다. | ||
- | ==== 샘플코드 ==== | + | ==== 샘플코드(C++) ==== |
- | C++ | + | <file cpp sample_setvoipconfigext.cpp> |
- | <code cpp> | + | BS2VoipConfigExt config = { 0, }; |
- | BS2VoipConfigExt config = { 0, }; | + | |
- | config.enabled = true; | + | config.enabled = true; |
- | config.useOutboundProxy = false; | + | config.useOutboundProxy = false; |
- | config.registrationDuration = 300; | + | config.registrationDuration = 300; |
- | string ipAddr = "192.168.0.9"; | + | string ipAddr = "192.168.0.9"; |
- | memcpy(config.address, ipAddr.c_str(), ipAddr.size()); | + | memcpy(config.address, ipAddr.c_str(), ipAddr.size()); |
- | config.port = 5060; | + | config.port = 5060; |
- | config.volume.speaker = 50; | + | config.volume.speaker = 50; |
- | config.volume.mic = 50; | + | config.volume.mic = 50; |
- | string sipID = "myAccount"; | + | string sipID = "myAccount"; |
- | memcpy(config.id, sipID.c_str(), sipID.size()); | + | memcpy(config.id, sipID.c_str(), sipID.size()); |
- | string sipPW = "myPassword"; | + | string sipPW = "myPassword"; |
- | memcpy(config.password, sipPW.c_str(), sipPW.size()); | + | memcpy(config.password, sipPW.c_str(), sipPW.size()); |
- | string authCode = "1234"; | + | string authCode = "1234"; |
- | memcpy(config.authorizationCode, authCode.c_str(), authCode.size()); | + | memcpy(config.authorizationCode, authCode.c_str(), authCode.size()); |
- | config.exitButton = Convert.ToByte('0'); // 0 | + | config.exitButton = '0'; // keypad 0 |
- | config.showExtensionNumber = true; | + | config.showExtensionNumber = true; |
- | config.numPhoneBook = 2; | + | config.numPhoneBook = 2; |
- | string phoneNum = "600"; | + | string phoneNum = "600"; |
- | memcpy(config.phonebook[0].phoneNumber, phoneNum.c_str(), phoneNum.size()); | + | memcpy(config.phonebook[0].phoneNumber, phoneNum.c_str(), phoneNum.size()); |
- | string phoneDesc = "LB James"; | + | string phoneDesc = "LB James"; |
- | memcpy(config.phonebook[0].description, phoneDesc.c_str(), phoneDesc.size()); | + | memcpy(config.phonebook[0].description, phoneDesc.c_str(), phoneDesc.size()); |
- | phoneNum = "601"; | + | phoneNum = "601"; |
- | memcpy(config.phonebook[1].phoneNumber, phoneNum.c_str(), phoneNum.size()); | + | memcpy(config.phonebook[1].phoneNumber, phoneNum.c_str(), phoneNum.size()); |
- | phoneDesc = "C Kershaw"; | + | phoneDesc = "C Kershaw"; |
- | memcpy(config.phonebook[1].description, phoneDesc.c_str(), phoneDesc.size()); | + | memcpy(config.phonebook[1].description, phoneDesc.c_str(), phoneDesc.size()); |
- | int sdkResult = BS2_SetVoipConfigExt(context, id, &config); | + | int sdkResult = BS2_SetVoipConfigExt(context, id, &config); |
- | if (BS_SDK_SUCCESS != sdkResult) | + | if (BS_SDK_SUCCESS != sdkResult) |
- | printf("BS2_SetVoipConfigExt call failed: %d", sdkResult);</code> | + | printf("BS2_SetVoipConfigExt call failed: %d", sdkResult); |
+ | </file> | ||
- | C# | + | ==== 샘플코드(C#) ==== |
- | <code cpp> | + | <file csharp sample_setvoipconfigext.cs> |
- | BS2VoipConfigExt config = Util.AllocateStructure<BS2VoipConfigExt>(); | + | BS2VoipConfigExt config = Util.AllocateStructure<BS2VoipConfigExt>(); |
- | config.enabled = Convert.ToByte(1); | + | config.enabled = Convert.ToByte(1); |
- | config.useOutboundProxy = Convert.ToByte(0); | + | config.useOutboundProxy = Convert.ToByte(0); |
- | config.registrationDuration = 300; | + | config.registrationDuration = 300; |
- | string strIpAddr = "192.168.0.9"; | + | string strIpAddr = "192.168.0.9"; |
- | byte[] arrIpAddr = Encoding.UTF8.GetBytes(strIpAddr); | + | byte[] arrIpAddr = Encoding.UTF8.GetBytes(strIpAddr); |
- | Array.Clear(config.address, 0, BS2Environment.BS2_URL_SIZE); | + | Array.Clear(config.address, 0, BS2Environment.BS2_URL_SIZE); |
- | Array.Copy(arrIpAddr, 0, config.address, 0, arrIpAddr.Length); | + | Array.Copy(arrIpAddr, 0, config.address, 0, arrIpAddr.Length); |
- | config.port = 5060; | + | config.port = 5060; |
- | config.volume.speaker = 50; | + | config.volume.speaker = 50; |
- | config.volume.mic = 50; | + | config.volume.mic = 50; |
- | string strSIPID = "myAccount"; | + | string strSIPID = "myAccount"; |
- | byte[] arrSIPID = Encoding.UTF8.GetBytes(strSIPID); | + | byte[] arrSIPID = Encoding.UTF8.GetBytes(strSIPID); |
- | Array.Clear(config.id, 0, BS2Environment.BS2_USER_ID_SIZE); | + | Array.Clear(config.id, 0, BS2Environment.BS2_USER_ID_SIZE); |
- | Array.Copy(arrSIPID, 0, config.id, 0, arrSIPID.Length); | + | Array.Copy(arrSIPID, 0, config.id, 0, arrSIPID.Length); |
- | string strSIPPW = "myPassword"; | + | string strSIPPW = "myPassword"; |
- | byte[] arrSIPPW = Encoding.UTF8.GetBytes(strSIPPW); | + | byte[] arrSIPPW = Encoding.UTF8.GetBytes(strSIPPW); |
- | Array.Clear(config.password, 0, BS2Environment.BS2_USER_ID_SIZE); | + | Array.Clear(config.password, 0, BS2Environment.BS2_USER_ID_SIZE); |
- | Array.Copy(arrSIPPW, 0, config.password, 0, arrSIPPW.Length); | + | Array.Copy(arrSIPPW, 0, config.password, 0, arrSIPPW.Length); |
- | string strAuthCode = "1234"; | + | string strAuthCode = "1234"; |
- | byte[] arrAuthCode = Encoding.UTF8.GetBytes(strAuthCode); | + | byte[] arrAuthCode = Encoding.UTF8.GetBytes(strAuthCode); |
- | Array.Clear(config.authorizationCode, 0, BS2Environment.BS2_USER_ID_SIZE); | + | Array.Clear(config.authorizationCode, 0, BS2Environment.BS2_USER_ID_SIZE); |
- | Array.Copy(arrAuthCode, 0, config.authorizationCode, 0, arrAuthCode.Length); | + | Array.Copy(arrAuthCode, 0, config.authorizationCode, 0, arrAuthCode.Length); |
- | config.exitButton = 1; | + | config.exitButton = Convert.ToByte('0'); // keypad 0 |
- | config.showExtensionNumber = Convert.ToByte(true); | + | config.showExtensionNumber = Convert.ToByte(true); |
- | config.numPhoneBook = 2; | + | config.numPhoneBook = 2; |
- | string strPhoneNum = "600"; | + | string strPhoneNum = "600"; |
- | byte[] arrPhoneNum = Encoding.UTF8.GetBytes(strPhoneNum); | + | byte[] arrPhoneNum = Encoding.UTF8.GetBytes(strPhoneNum); |
- | Array.Clear(config.phonebook[0].phoneNumber, 0, BS2Environment.BS2_USER_ID_SIZE); | + | Array.Clear(config.phonebook[0].phoneNumber, 0, BS2Environment.BS2_USER_ID_SIZE); |
- | Array.Copy(arrPhoneNum, 0, config.phonebook[0].phoneNumber, 0, arrPhoneNum.Length); | + | Array.Copy(arrPhoneNum, 0, config.phonebook[0].phoneNumber, 0, arrPhoneNum.Length); |
- | string strPhoneDesc = "LB James"; | + | string strPhoneDesc = "LB James"; |
- | byte[] arrPhoneDesc = Encoding.UTF8.GetBytes(strPhoneDesc); | + | byte[] arrPhoneDesc = Encoding.UTF8.GetBytes(strPhoneDesc); |
- | Array.Clear(config.phonebook[0].description, 0, BS2Environment.BS2_VOIP_MAX_DESCRIPTION_LEN_EXT); | + | 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); | + | Array.Copy(arrPhoneDesc, 0, config.phonebook[0].description, 0, arrPhoneDesc.Length); |
- | strPhoneNum = "601"; | + | strPhoneNum = "601"; |
- | arrPhoneNum = Encoding.UTF8.GetBytes(strPhoneNum); | + | arrPhoneNum = Encoding.UTF8.GetBytes(strPhoneNum); |
- | Array.Clear(config.phonebook[1].phoneNumber, 0, BS2Environment.BS2_USER_ID_SIZE); | + | Array.Clear(config.phonebook[1].phoneNumber, 0, BS2Environment.BS2_USER_ID_SIZE); |
- | Array.Copy(arrPhoneNum, 0, config.phonebook[1].phoneNumber, 0, arrPhoneNum.Length); | + | Array.Copy(arrPhoneNum, 0, config.phonebook[1].phoneNumber, 0, arrPhoneNum.Length); |
- | strPhoneDesc = "C Kershaw"; | + | strPhoneDesc = "C Kershaw"; |
- | arrPhoneDesc = Encoding.UTF8.GetBytes(strPhoneDesc); | + | arrPhoneDesc = Encoding.UTF8.GetBytes(strPhoneDesc); |
- | Array.Clear(config.phonebook[1].description, 0, BS2Environment.BS2_VOIP_MAX_DESCRIPTION_LEN_EXT); | + | 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); | + | Array.Copy(arrPhoneDesc, 0, config.phonebook[1].description, 0, arrPhoneDesc.Length); |
- | BS2ErrorCode result = (BS2ErrorCode)API.BS2_SetVoipConfigExt(sdkContext, deviceID, ref config); | + | BS2ErrorCode result = (BS2ErrorCode)API.BS2_SetVoipConfigExt(sdkContext, deviceID, ref config); |
- | if (result != BS2ErrorCode.BS_SDK_SUCCESS) | + | if (result != BS2ErrorCode.BS_SDK_SUCCESS) |
- | { | + | { |
- | Console.WriteLine("Got error({0}).", result); | + | Console.WriteLine("Got error({0}).", result); |
- | } | + | } |
- | </code> | + | </file> |