Set-TwilioNumber.ps1

function Set-TwilioNumber
{
    param(
    [Parameter(ValueFromPipelineByPropertyName=$true)][string]$Sid,  
    [Uri]$VoiceUrl,
    [Uri]$SmsUrl,  
    [Management.Automation.PSCredential]
    $Credential
    )
    
    process {
        if (-not $Credential) {
            $credential = Get-TwilioCredential -ValueOnly | Select-Object -First 1 
            
        }
        if (-not $Credential) {
            Write-Error "No Twilio Credential provided. Use -Credential or Set-TwilioCredential first"               
            return
        }
        
        $webParams = @{} + $psboundparameters
        $webParams.Remove('Credential')
        $webParams.Remove('Sid')

        $getWebParams = @{
            WebCredential=$Credential
            Url="https://api.twilio.com/2010-04-01/Accounts/$($Credential.GetNetworkCredential().Username.Trim())/IncomingPhoneNumbers/$($sid.Trim())"           
            Method="POST"
            AsXml =$true
            Parameter = $webParams            
            UseWebRequest = $true
        }        
        Get-Web @getwebParams -Verbose | 
            Select-Object -ExpandProperty TwilioResponse
            
              
    }       
}