我有一个已编译并运行的Siphon应用程序,但它就是无法拨打电话。
我收到以下错误消息:
注册出错-默认错误信息。
完整错误如下:
15:04:02.032 pjsua_call.c 使用ACC #0拨打sip:6476805821@voip5-2.acanac.com 15:04:02.032 pjsua_call.c .无法拨打电话,因为帐户无效:无效操作(PJ_EINVALIDOP) [status=70013] 15:04:05.580 call.m 拨打电话时出现错误:无效操作(PJ_EINVALIDOP) [status=70013]
但当我在另一个SIP应用上使用相同的帐户时,它可以正常工作。
当pjsip调用sip_dial_with_uri(_sip_acc_id, [url UTF8String], &call_id);
_sip_acc_id为0,因为我认为在siphon的设置中是第0个帐户。 url是我尝试拨打的正确电话号码,但显示类似于: sip:62304892@url.com 而拨打id只是一个引用,所以我不知道它是否很重要。
当我查看其他VOIP应用时,它们都有一个注册过程。您需要输入用户名、密码和SIP服务器域或IP。
对于Siphon,这是在设置文件中完成的。但是,如果"Siphon"的代码中是否执行了"注册或登录",我不确定。 那可能是问题所在吗?
这是尝试实际拨打电话的代码:
/** FIXME plutôt à mettre dans l'objet qui gère les appels **/
-(void) dialup:(NSString *)phoneNumber number:(BOOL)isNumber
{
pjsua_call_id call_id;
pj_status_t status;
NSString *number;
UInt32 hasMicro, size;
// Verify if microphone is available (perhaps we should verify in another place ?)
size = sizeof(hasMicro);
AudioSessionGetProperty(kAudioSessionProperty_AudioInputAvailable,
&size, &hasMicro);
/*if (!hasMicro)
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"No Microphone Available", @"SiphonApp")
message:NSLocalizedString(@"Connect a microphone to phone", @"SiphonApp")
delegate:nil
cancelButtonTitle:NSLocalizedString(@"OK", @"SiphonApp")
otherButtonTitles:nil];
[alert show];
[alert release];
return;
}*/
if (isNumber)
number = [self normalizePhoneNumber:phoneNumber];
else
number = phoneNumber;
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"removeIntlPrefix"])
{
number = [number stringByReplacingOccurrencesOfString:@"+"
withString:@""
options:0
range:NSMakeRange(0,1)];
}
else
{
NSString *prefix = [[NSUserDefaults standardUserDefaults] stringForKey:
@"intlPrefix"];
if ([prefix length] > 0)
{
number = [number stringByReplacingOccurrencesOfString:@"+"
withString:prefix
options:0
range:NSMakeRange(0,1)];
}
}
// Manage pause symbol
NSArray * array = [number componentsSeparatedByString:@","];
[callViewController setDtmfCmd:@""];
if ([array count] > 1)
{
number = [array objectAtIndex:0];
[callViewController setDtmfCmd:[array objectAtIndex:1]];
}
if (!isConnected && [self wakeUpNetwork] == NO)
{
_phoneNumber = [[NSString stringWithString: number] retain];
if (isIpod)
{
UIAlertView *alertView = [[[UIAlertView alloc] initWithTitle:nil
message:NSLocalizedString(@"You must enable Wi-Fi or SIP account to place a call.",@"SiphonApp")
delegate:nil
cancelButtonTitle:NSLocalizedString(@"OK",@"SiphonApp")
otherButtonTitles:nil] autorelease];
[alertView show];
}
else
{
UIActionSheet *actionSheet = [[[UIActionSheet alloc] initWithTitle:NSLocalizedString(@"The SIP server is unreachable!",@"SiphonApp")
delegate:self
cancelButtonTitle:NSLocalizedString(@"Cancel",@"SiphonApp")
destructiveButtonTitle:nil
otherButtonTitles:NSLocalizedString(@"Cellular call",@"SiphonApp"),
nil] autorelease];
actionSheet.actionSheetStyle = UIActionSheetStyleDefault;
[actionSheet showInView: self.window];
}
return;
}
if ([self sipConnect])
{
NSRange range = [number rangeOfString:@"@"];
NSLog(@"%i", _sip_acc_id);
if (range.location != NSNotFound)
{
status = sip_dial_with_uri(_sip_acc_id, [[NSString stringWithFormat:@"sip:%@", number] UTF8String], &call_id);
}
else
status = sip_dial(_sip_acc_id, [number UTF8String], &call_id);
if (status != PJ_SUCCESS)
{
// FIXME
//[self displayStatus:status withTitle:nil];
const pj_str_t *str = pjsip_get_status_text(status);
NSString *msg = [[NSString alloc]
initWithBytes:str->ptr
length:str->slen
encoding:[NSString defaultCStringEncoding]];
[self displayError:msg withTitle:@"registration error"];
}
}
}
如果有人有Siphon应用程序的更新版本代码,并且可能功能更好,我也会感激不尽。
更多信息:
在call.m文件中,基本上会调用此函数:
status = pjsua_call_make_call(acc_id, &pj_uri, 0, NULL, NULL, call_id);
并且在这里
acc_id = 0
pj_uri = 字符串指针 -> "sip:6476805821@voip5-2.acanac.com" pj_ssize_t -> 33
call_id = 803203976