如果网关支持这个功能的话,我们就可以通过端来获得号码了,以下代码可以做为测试,看看你连接的移动网关是不是支持:
public static string GetPhoneNumber(HttpRequest request)
{
string phone = "" ;
NameValueCollection coll = null ;
try
{
coll = request.ServerVariables ;
}
catch {}
try
{
if (phone == "")
{
phone = coll["HTTP_X_UP_CALLING_LINE_ID"].ToString() ;
}
}
catch {}
try
{
if (phone == "")
{
phone = coll["MISC_MSISDN"].ToString() ;
}
}
catch {}
try
{
if (phone == "")
{
phone = coll["x-up-calling-line-id"].ToString() ;
}
}
catch {}
try
{
if (phone == "")
{
phone = coll["HTTP_X_NOKIA_MSISDN"].ToString() ;
}
}
catch {}
try
{
if (phone.Length > 11)
{
phone = phone.Substring(2) ;
}
}
catch(Exception ex)
{
phone = ex.Message ;
}
return phone ;
}
客房端可以写个简单的测试程序。